Abstract. Generic types in the Java programming language provide the convenience of writing generic code and perform compilation-time type checking. However, the implementation based on type erasure discards type instance information before run time, complicating dynamic optimizations. We propose a specialization of generic types- a sourceto-source transformation that creates specialized copies of a subset of generic classes, replacing their type bounds with specific instance types. Making instance type information available at run time removes unnecessary typecasting and enables the JVM to perform optimizations, such as method inlining. However, interactions of type specialization with the JVM are complex. Specializing more classes may introduce inefficiencies due to extra typechecks, array operations, or JVM warmup. We study trade-offs between effects of type specialization and suggest criteria for selecting groups of classes for performance improvements. As an example, we compare different ways of specializing subsets of the Java collections library and present an algorithm for specializing such classes. Both the client and the server modes of Sun’s HotSpot JVM are studied. We show that generic type specialization enables a program speed up of up-to 20 % by specializing only a few classes.