Sound and Extensible Renaming for Java']Java

被引:4
|
作者
Schaefer, Max [1 ]
Ekman, Torbjoern [1 ]
de Moor, Oege [1 ]
机构
[1] Univ Oxford, Programming Tools Grp, Oxford OX1 2JD, England
基金
英国工程与自然科学研究理事会;
关键词
Languages; Refactoring; name analysis; renaming; extensible compilers;
D O I
10.1145/1449955.1449787
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Descriptive names are crucial to understand code. However, good names are notoriously hard to choose and manually changing a globally visible name can be a maintenance nightmare. Hence, tool support for automated renaming is an essential aid for developers and widely supported by popular development environments. This work improves on two limitations in current refactoring tools: too weak preconditions that lead to unsoundness where names do not bind to the correct declarations after renaming, and too strong preconditions that prevent renaming of certain programs. We identify two main reasons for unsoundness: complex name lookup rules make it hard to define sufficient preconditions, and new language features require additional preconditions. We alleviate both problems by presenting a novel extensible technique for creating symbolic names that are guaranteed to bind to a desired entity in a particular context by inverting lookup functions. The inverted lookup functions can then be tailored to create qualified names where otherwise a conflict would occur, allowing the refactoring to proceed and improve on the problem with too strong preconditions. We have implemented renaming for Java as an extension to the JastAdd Extensible Java Compiler and integrated it in Eclipse. We show examples for which other refactoring engines have too weak preconditions, as well as examples where our approach succeeds in renaming entities by inserting qualifications. To validate the extensibility of the approach we have implemented renaming support for Java 5 and AspectJ like inter-type declarations as modular extensions to the initial Java 1.4 refactoring engine. The renaming engine is only a few thousand lines of code including extensions and performance is on par with industrial strength refactoring tools.
引用
收藏
页码:277 / 294
页数:18
相关论文
共 50 条
  • [1] Sound and Extensible Renaming for Java']Java
    Schaefer, Max
    Ekman, Torbjoern
    de Moor, Oege
    [J]. OOPSLA 2008 NASHVILLE, CONFERENCE PROCEEDINGS: MUSIC CITY USA, OOPSLA, 2008, : 277 - 294
  • [2] Sound and extensible renaming for Java
    Programming Tools Group, University of Oxford, United Kingdom
    [J]. ACM SIGPLAN Not., 10 (277-294):
  • [3] The JastAdd Extensible Java']Java Compiler
    Ekman, Torbjorn
    Hedin, Gorel
    [J]. ACM SIGPLAN NOTICES, 2007, 42 (10) : 1 - 17
  • [4] Extensible numerical library in JAVA']JAVA
    Aso, T
    Okazawa, H
    Sasaki, T
    Takashimizu, N
    [J]. PROCEEDINGS OF CHEP 2001, 2001, : 536 - 539
  • [5] The JastAdd Extensible Java']Java Compiler
    Ekman, Torbjoern
    Hedin, Gorel
    [J]. OOPSLA: 22ND INTERNATIONAL CONFERENCE ON OBJECT-ORIENTED PROGRAMMING, SYSTEMS, LANGUAGES, AND APPLICATIONS, PROCEEDINGS, 2007, : 1 - 17
  • [6] Overcoming the obfuscation of Java']Java programs by identifier renaming
    Cimato, S
    De Santis, A
    Petrillo, UF
    [J]. JOURNAL OF SYSTEMS AND SOFTWARE, 2005, 78 (01) : 60 - 72
  • [7] Unique renaming of Java']Java using source transformation
    Guo, XP
    Cordy, JR
    Dean, TR
    [J]. THIRD IEEE INTERNATIONAL WORKSHOP ON SOURCE CODE ANALYSIS AND MANIPULATION - PROCEEDINGS, 2003, : 151 - 160
  • [8] Polyglot: An extensible compiler framework for Java']Java
    Nystrom, N
    Clarkson, MR
    Myers, AC
    [J]. COMPILER CONSTRUCTION, PROCEEDINGS, 2003, 2622 : 138 - 152
  • [9] JGROOVY - AN EXPERIMENTAL OF EXTENSIBLE JAVA']JAVA COMPILER
    Sateanpattanakul, Siwadol
    Walairacht, Aranya
    [J]. 2011 INTERNATIONAL CONFERENCE ON MECHANICAL ENGINEERING AND TECHNOLOGY (ICMET 2011), 2011, : 807 - 810
  • [10] Extensible Modeling with Managed Data in Java']Java
    Zacharopoulos, Theologos
    Inostroza, Pablo
    van der Storm, Tijs
    [J]. ACM SIGPLAN NOTICES, 2017, 52 (03) : 25 - 35