Open Access. Powered by Scholars. Published by Universities.®

Physical Sciences and Mathematics Commons

Open Access. Powered by Scholars. Published by Universities.®

Computer Sciences

PDF

City University of New York (CUNY)

2010

Enumerated types

Articles 1 - 1 of 1

Full-Text Articles in Physical Sciences and Mathematics

Enumeration Refactoring: A Tool For Automatically Converting Java Constants To Enumerated Types, Raffi T. Khatchadourian, Benjamin Muskalla Sep 2010

Enumeration Refactoring: A Tool For Automatically Converting Java Constants To Enumerated Types, Raffi T. Khatchadourian, Benjamin Muskalla

Publications and Research

Java 5 introduces several new features that significantly improve older Java technology. We 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, notably type-safety. We demonstrate an automated refactoring tool called Convert Constants to Enum for transforming legacy Java code to use the new enumeration construct. An interprocedural type inferencing algorithm that tracks the flow of enumerated values drives the approach, and the tool is …