| Summary: | [pull up] the program behavior changes for call to super.k() | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Gustavo Soares <gsoares> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | markus.kell.r |
| Version: | 3.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; pt-BR; rv:1.9.0.14) Gecko/2009090216 Ubuntu/9.04 (jaunty) Firefox/3.0.14 GTB5 Build Identifier: M20090211-1700 When is applied a pull up refactoring on a method that calls another using the "super", the engine change the "super" for "this". This can change the behavior of the code if the subclass contains a method with the same signature of the called method. Reproducible: Always Steps to Reproduce: 1. Create the classes: public class A { public int k() { return 79;} } public class B extends A{ public int k() { return 83;} public int m() { return super.k();} public static void main(String[] args) { B b = new B(); System.out.println(b.m()); } } 2. This program prints 79. Apply a pull up method refactoring on m(). The program will be transformed: public class A { public int k() { return 79;} public int m() { return this.k();} } public class B extends A{ public int k() { return 83;} public static void main(String[] args) { A b = new B(); System.out.println(b.m()); } } 3. After the refactoring, the behavior of the program changes, now, it will be printed 83