I would like to know what tool can be used to view code after type erasure. For example, I'd like to see what the following code looks like after type erasure. I know that generic type information is stripped prior to final compilation, replacing type references with Object or boundary types, creating bridge methods, etc. I want to see the source code after the erasure process takes place.
public static void main(String[] args) {
Predicate<Object> objPredicate = (Object c) -> c.toString().length() > 2 ;
Predicate<? super Integer> predicate = objPredicate;
Number n = Integer.valueOf(22);
System.out.println(predicate.test(n)); //this line does not compile
}
[If compiling code is required to see an erasure inspection tool work on the example, the non-compiling line can be omitted or n can be cast to Integer]