Efficiently refactoring Java applications to use generic libraries

Download: PDF.

“Efficiently refactoring Java applications to use generic libraries” by Robert Fuhrer, Frank Tip, Adam Kieżun, Julian Dolby, and Markus Keller. In ECOOP 2005 — Object-Oriented Programming, 19th European Conference, (Glasgow, Scotland), July 27-29, 2005, pp. 71-96.
A previous version appeared as “Refactoring techniques for migrating applications to generic Java container classes” by Frank Tip, Robert Fuhrer, Julian Dolby, and Adam Kieżun, IBM T.J. Watson Research Center IBM Research Report RC 23238, (Yorktown Heights, NY, USA). June 2, 2004.


Java 1.5 generics enable the creation of reusable container classes with compiler-enforced type-safe usage. This eliminates the need for potentially unsafe down-casts when retrieving elements from containers. We present a refactoring that replaces raw references to generic library classes with parameterized references. The refactoring infers actual type parameters for allocation sites and declarations using an existing framework of type constraints, and removes casts that have been rendered redundant. The refactoring was implemented in Eclipse, a popular open-source development environment for Java, and laid the grounds for a similar refactoring in the forthcoming Eclipse 3.1 release. We evaluated our work by refactoring several Java programs that use the standard collections framework to use Java 1.5's generic version instead. In these benchmarks, on average, 48.6% of the casts are removed, and 91.2% of the compiler warnings related to the use of raw types are eliminated. Our approach distinguishes itself from the state-of-the-art [8] by being more scalable, by its ability to accommodate user-defined subtypes of generic library classes, and by being incorporated in a popular integrated development environment.

Download: PDF.

BibTeX entry:

   author = {Robert Fuhrer and Frank Tip and Adam Kie{\.z}un and Julian
	Dolby and Markus Keller},
   title = {Efficiently refactoring {Java} applications to use generic
   booktitle = {ECOOP 2005 --- Object-Oriented Programming, 19th European
   pages = {71--96},
   address = {Glasgow, Scotland},
   month = {July~27--29,},
   year = {2005}

(This webpage was created with bibtex2web.)

Back to Program Analysis Group publications.