[Biojava-dev] The future of BioJava

Mark Schreiber markjschreiber at gmail.com
Sat Sep 22 11:31:29 UTC 2007


> 2). It is impossible to infer the type of a generic i.e.
>
> public <T> void doSomething(T genericObject) {
>         if(T.equals(String.class)) {
>                 //Do something
>         }
> }
>
> This T type is ... well magical. It exists but it doesn't.
>

T only exists at compile time. It doesn't exist at all in the JVM.
This is because Java generics are implemented using 'erasure'.  It is
a bit of a drawback but no getting around it.



More information about the biojava-dev mailing list