| Summary: | [move method] incorrect update of referencing the member of destination when moved via fields | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jongwook Kim <jongwook.kim> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jongwook.kim, stolz+bugzilla |
| Version: | 3.8.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
Reproducible in Eclipse 3.8.1 also. *** Bug 444284 has been marked as a duplicate of this bug. *** Note to developers: Note that this will not be easy to fix as there cannot be a complete static check for this property. http://boemund.dagstuhl.de/mat/Files/14/14211/14211.StolzVolker.Slides.pdf http://prezi.com/w5dikhkpjzmu/?utm_campaign=share&utm_medium=copy&rc=ex0share (In reply to Volker Stolz from comment #3) > Note to developers: > Note that this will not be easy to fix as there cannot be a complete static > check for this property. > > http://boemund.dagstuhl.de/mat/Files/14/14211/14211.StolzVolker.Slides.pdf > http://prezi.com/w5dikhkpjzmu/?utm_campaign=share&utm_medium=copy&rc=ex0share I clicked a bit too fast. Of course this can be easily fixed to follow Jongwook's suggestion. Figuring out when using the "shorter" form (as will be probably intended by a user) is correct is difficult. 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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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. |
When A.m() is moved to class B via A.b below, Reference b.i is updated to i after refactoring. That changes semantics. -------------------- Before (Output: 2) public class A { B b = new B(1); void n(B b1) { b = b1; } void m() { n(new B(2)); System.out.println(b.i); // what should b.i be after move? } } public class B { int i = 0; public B(int j) { i = j; } } public class C { public static void main(String[] args) { A a = new A(); a.m(); } } -------------------- After (Output: 1) public class A { B b = new B(1); void n(B b1) { b = b1; } } public class B { int i = 0; public B(int j) { i = j; } void m(A a) { a.n(new B(2)); System.out.println(i); // should be a.b.i, NOT i } } public class C { public static void main(String[] args) { A a = new A(); a.b.m(a); } }