Converting Java Classes to Use Generics
Abstract
Generics offer significant software engineering benefits since
they provide code reuse without compromising type safety.
Thus generics will be added to the Java language in the next
release. While this extension to Java will help programmers
when they are writing new code, it will not help legacy code
unless it is rewritten to use generics. In our experience, manually
modifying existing programs to use generics is complex
and can be error prone and labor intensive.
We describe a system, Ilwith, that (i) converts non-generic
classes to generic classes and (ii) rewrites their clients to use
the newly generified classes. Our experiments with a number
of Java container classes show that our system is effective in
modifying legacy code to use generics.