“When a generic type is instantiated, the compiler translates those types by a technique called type erasure — a process where the compiler removes all information related to type parameters and type arguments within a class or method. Type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created before generics.”

“The Java compiler employs type erasure when objects are instantiated except when objects are instantiated from anonymous classes.” reference 1

Motivated by HX question on using reflection reference 2

 1 public class TryReflection {
 2    public static void main(String[] args) {
 3       List stringList = new ArrayList() {};
 4       List bdList = new ArrayList() {};
 5       List intList = new ArrayList() {};
 6       List pList = new ArrayList() {};
 7       System.out.println(getName(stringList)); //output should be String
 8       System.out.println(getName(bdList)); //output should be BigDecimal
 9       System.out.println(getName(intList)); //output should be Integer
10       System.out.println(getName(pList)); //output should be Properties}
11    }
12    public static String getName(List list2) {
13       return list2.getClass().getGenericSuperclass().toString();
14    }
15 }