Bug 495899 - [move method] an extra parameter of the original class type should be introduced
Summary: [move method] an extra parameter of the original class type should be introduced
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-10 13:36 EDT by Jongwook Kim CLA
Modified: 2023-04-29 17:59 EDT (History)
2 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 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.