Optimization of Java Generic Types

Short Introduction:

Read the paper

Generic types in Java are implemented using type erasure. This means that types are checked at compile time, and then code is generated that is type agnostic. The advantage is that you only need one compiled version of any bit of generic code, but the disadvantage is that the JIT compiler has lost any sort of type information that can help produce more efficient code.

This differs from the implementation of generic types as templates in C++ were a new code is generated for every unique type instantiation. The advantage of templates is that the compiler is able to optimize the code based of the types used, but the disadvantage is the increased amount of generated code.


To find out more, check out our paper, Specialization of Java Generic Types (pdf), which was written for, and presented at MICS 2006.

Also, feel free to browse our research wiki page. UMM CSci TWiki page Be warned that the UMM CSci wiki is really pokey, and may be moved to a new location soon.