Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 441204

Summary: [move method] wrong precondition check about references to enclosing instances
Product: [Eclipse Project] JDT Reporter: Jongwook Kim <jongwook.kim>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jongwook.kim, noopur_gupta
Version: 3.8.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Jongwook Kim CLA 2014-08-05 15:32:16 EDT
In the following example, when A.m(B) is moved to B, JDT says that 'A.this.i' is a reference to enclosing instances (which is wrong detection).

public class A {
	public int i = 0;
	
	public void m(B b) {
		new C() {
			public void n() {
				i = 1;		// Allowed
				A.this.i = 0;	// Violate precondition (ERROR)
			}
		};
	}
}
Comment 1 Noopur Gupta CLA 2014-08-08 05:20:13 EDT
Reproducible in Eclipse 3.8.1 also.
Comment 2 Eclipse Genie CLA 2020-03-13 10:23:41 EDT
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.