http://lattes.cnpq.br/6215732726947926; SOARES, Gustavo Araújo.
Abstract:
Program Refactorings are behavior-preserving transformations. Each transformation can
have a number of preconditions that must be satisfied to assure the behavior reservation.
Many IDEs, such as Eclipse and NetBeans, automate a number of refactorings. However,
these tools may perform incorrect transformations that introduce compilation errors (simple to be detected) or behavioral changes (very often go undetected). This happens because each tool implements refactorings based on an informal set of refactoring preconditions. In fact, there is no formal theory that establishes all preconditions for each refactoring in Java. In this work, we propose an approach and its implementation (SAFEREFACTOR) for making Java sequential program refactorings safer. Our technique detects behavioral changes in transformations performed on sequential programs. We evaluated it in three experiments. First, our technique was applied against 16 non-behavior-preserving transformations that are not detected by IDEs that implement refactorings. SAFEREFACTOR detected all behavioral changes. Next, we evaluated it on seven refactorings of real Java programs (from 3 to 100 KLOC) performed by developers that used refactoring tools and unit tests to guarantee the behavior preservation. Our technique detected a behavioral change in a refactoring applied to JHotDraw (23 KLOC). Finally, we propose a Java program generator (JDolly) in order to generate program inputs to refactoring implementations. We used SAFEREFACTOR and JDolly to test 11 refactorings implemented by Eclipse 3.4.2. JDolly automatically generated a number of programs to be refactored using Eclipse API. SAFEREFACTOR identified 50 bugs in these transformations (35 behavioral changes and 15 compilation errors). We manually identified that some of these bugs also happen in NetBeans 6.7.