Enumeration Refactoring: A Tool for Automatically Converting Java Constants to Enumerated Types

Date Added: Sep 2010
Format: PDF

Java 5 introduces several new features that offer significant improvements over older Java technology. The authors consider the new enum construct, which provides language support for enumerated types. Before Java 5, programmers needed to employ various patterns to compensate for the absence of enumerated types in Java. Unfortunately, these compensation patterns lack several highly desirable properties of the enum construct, most notably, type-safety. They demonstrate an automated refactoring tool called Convert Constants to Enum for transforming legacy Java code to use the new enumeration construct. An inter-procedural type inferencing algorithm that tracks the flow of enumerated values drives the approach, and the tool is implemented as a seamless extension to existing refactoring support in Eclipse.