skip to main content
10.1145/1858996.1859036acmconferencesArticle/Chapter ViewAbstractPublication PagesaseConference Proceedingsconference-collections
demonstration

Enumeration refactoring: a tool for automatically converting Java constants to enumerated types

Published:20 September 2010Publication History

ABSTRACT

Java 5 introduces several new features that offer significant improvements over 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, most 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 implemented as a seamless extension to existing refactoring support in Eclipse. The resulting code is semantically equivalent to the original, increasingly type-safe, easier to comprehend, less complex, and supports separate compilation.

References

  1. }}J. Bloch. Effective Java Programming Language Guide. Prentice Hall PTR, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}A. V. Deursen and L. Moonen. Type inference for COBOL systems. In WCRE, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}A. V. Deursen and L. Moonen. Understanding cobol systems using inferred types. In IWPC, 1999.Google ScholarGoogle ScholarCross RefCross Ref
  4. }}P. H. Eidorff, F. Henglein, C. Mossin, H. Niss, M. H. Sørensen, and M. Tofte. Annodomini: From type theory to year 2000 conversion tool. In POPL, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}R. Fuhrer, F. Tip, A. Kieżun, J. Dolby, and M. Keller. Efficiently refactoring Java applications to use generic libraries. In ECOOP, pages 71--96, July 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}J. M. Gravley and A. Lakhotia. Identifying enumeration types modeled with symbolic constants. In WCRE, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}J. Kerievsky. Refactoring to Patterns. Pearson, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}R. Khatchadourian, J. Sawin, and A. Rountev. Automated refactoring of legacy Java software to enumerated types. In ICSM, 2007.Google ScholarGoogle ScholarCross RefCross Ref
  10. }}A. Kie&3380;un, M. D. Ernst, F. Tip, and R. M. Fuhrer. Refactoring for parameterizing Java classes. In ICSE, 2007.Google ScholarGoogle Scholar
  11. }}B. C. Pierce. Types and programming languages. MIT Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}G. Ramalingam, J. Field, and F. Tip. Aggregate structure identification and its application to program analysis. In POPL, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}W. Tansey and E. Tilevich. Annotation refactoring: inferring upgrade transformations for legacy applications. In OOPSLA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Enumeration refactoring: a tool for automatically converting Java constants to enumerated types

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      ASE '10: Proceedings of the 25th IEEE/ACM International Conference on Automated Software Engineering
      September 2010
      534 pages
      ISBN:9781450301169
      DOI:10.1145/1858996

      Copyright © 2010 Copyright is held by the owner/author(s)

      Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 20 September 2010

      Check for updates

      Qualifiers

      • demonstration

      Acceptance Rates

      Overall Acceptance Rate82of337submissions,24%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader