Bug 432845 - [move method] incorrect update of references inside anonymous class declaration
Summary: [move method] incorrect update of references inside anonymous class declaration
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 439969 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-15 12:26 EDT by Jongwook Kim CLA
Modified: 2022-07-19 16:58 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jongwook Kim CLA 2014-04-15 12:26:44 EDT
Here is original source code:

public class A {
	public void a() {
		new B() {
			public void b(){
				m(new C());
			}
		};
	}
}


public class B {
	public int i = 0;
	
	public void m(C c) {
		i++;
	}
}

When B.m(C) is moved to class C "without" delegate, the refactored code is wrong:

public class A {
	public void a() {
		new B() {
			public void b(){
				new C().m(B.this);	/* INCORRECT */
			}
		};
	}
}
Comment 1 Noopur Gupta CLA 2014-04-16 02:41:39 EDT
Reproducible with Eclipse 3.8.1 also.
Comment 2 Martin Mathew CLA 2014-07-21 19:36:46 EDT
*** Bug 439969 has been marked as a duplicate of this bug. ***
Comment 3 Eclipse Genie CLA 2020-06-20 19:48:23 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.

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.
Comment 4 Eclipse Genie CLA 2022-07-17 19:42:14 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.

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.
Comment 5 Jeff Johnston CLA 2022-07-19 16:54:24 EDT
This problem still exists in 2022-09 M1.
Comment 6 Andrey Loskutov CLA 2022-07-19 16:58:40 EDT
(In reply to Jeff Johnston from comment #5)
> This problem still exists in 2022-09 M1.

I would say same root cause like described in https://github.com/eclipse-jdt/eclipse.jdt.core/pull/248

JDT model doesn't support types inside anonymous types well.