Bug 241035

Summary: [pull up] refactoring causes compile an error because it replaces wrong destination type
Product: [Eclipse Project] JDT Reporter: Hoon Kim <hoonkim3>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug

Description Hoon Kim CLA 2008-07-15 22:32:24 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. In the following code
 A.java
package p;

class A {
	void a(A a){}
	void a(B b){}
}

B.java
package p;

class B extends A {
	void m() { 
		a(this);
	}
}

2. pull up B.m() to class A
3. the above code becomes
A.java
package p;

class A {
	void a(A a){}
	void a(A b){}
	void m() { 
		a(this);
	}
}
B.java
package p;

class B extends A {
}
4. Compile error is detected


More information:
When I pull up the B.m() method to class A, the refactoring engine process the pull up refactoring although the result code cannot be complied.

Although the refactoring engine does not need to change method signature ¡°void a(B b)¡±, the engine changes it to ¡°void a(A b)¡± in somehow. This causes this bug. The expected result is 
A.java
package p;

class A {
	void a(A a){}
	void a(B b){}
	void m() { 
		a(this);
	}
}
B.java
package p;

class B extends A {
}
Comment 1 Dani Megert CLA 2008-07-16 03:00:01 EDT
To reproduce the 'Use destination type where possible' needs to be checked.
Comment 2 Eclipse Genie CLA 2019-05-04 12:48:54 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-05-05 10:39:49 EDT
Still a problem in 4.12 M1.
Comment 4 Eclipse Genie CLA 2021-04-25 08:13:46 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-05-07 14:56:15 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.