Question: In this tutorial on [reflection](http://docs.oracle.com/javase/tutorial/reflect/member/fieldTypes.html) it states: 

> 
> [...] because generics are implemented via type erasure which removes all information regarding generic types during compilation
> 
> 
> 

My knowledge was that generics are used so that at compile time the compiler can check for type safety. i.e fail fast approach.
But the link mentions that type erasure removes generic information during compilation.

Answer: 
Some generics stay in the compiled class -- specifically including method signatures and class definitions, for example. At runtime, no *objects* keep their full generic type, but even at runtime you can look up the generic definition of a class or a method. 

For example, if you have

```
class Foo {
  List<String> getList() { ... }

  public static void main(String[] args) {
    System.out.println(Foo.class.getMethod("getList").getGenericReturnType());
    // prints "List<String>"
    List<String> list = new Foo().getList();
    // there is no way to get the "String" parameter on list
}

```
It means, when it is being converted into bytecode. For checking whether correct types are used or not, generics are used. But at the time of bytecode generation, information is removed