Bug 495899

Summary: [move method] an extra parameter of the original class type should be introduced
Product: [Eclipse Project] JDT Reporter: Jongwook Kim <jongwook.kim>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, jongwook.kim
Version: 4.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Jongwook Kim CLA 2016-06-10 13:36:27 EDT
When method A.m is moved to class B without leaving behind a delegate, class creation new A() is not evaluated after the move. That is because JDT does not introduce an extra parameter of type A when method m has no references to the members of A. It changes program behavior when the prefix expression of m invocation causes side effects. 

BEFORE
-----------------------------------
class A {
	void m(B b) {}

	void n() {
		new A().m(new B());
	}
}


AFTER
-----------------------------------
class A {
	void n() {
		new B().m();  // BUG: new A() is removed
	}
}

class B {
	void m() {}
}
Comment 1 Jongwook Kim CLA 2016-06-10 13:40:14 EDT
The extra parameter (of original class type A) is unnecessary only when the prefixes of all method invocations are simple variables, which are free from
side-effects.
Comment 2 Eclipse Genie CLA 2019-04-29 02:23:33 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 3 Dani Megert CLA 2019-04-29 04:26:29 EDT
Still an issue in 4.12 M1.
Comment 4 Eclipse Genie CLA 2021-04-20 15:30:39 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 Eclipse Genie CLA 2023-04-29 17:59:47 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.