Bug 241036

Summary: [pull up] pull up causes compile error in case of generic methods calls
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:50:14 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1.In the following code
class A<T> {
	void a(T t){}
}

class B extends A<String> {
	public void m() { 
		super.a(null);
		super.a(new String());
	}
}

2. pull up B.m() to class A
3. Refactoring engine produces the following code
class A<T> {
	void a(T t){}

	public void m() { 
		this.a(null);
		this.a(new String());
	}
}

class B extends A<String> {
}
4. "this.a(new String());" causes a compile error

More information:
When I pull up B.m() to class A, output causes a compile error from ¡°this.a(new String());¡±.

From the original test code, Parameter type of method A.a() is set to String because class B is inherited from A<String>. However, in the test output, Type T for the parameter of A.a() is not set yet. Thus, new String() need to be casted by T. Although, it is not safe in many cases, the refactoring engine has the bug.

Expected output:
package p;

class A<T> {
	void a(T t){}

	public void m() { 
		this.a(null);
		this.a((T) new String());
	}
}

class B extends A<String> {
}
Comment 1 Eclipse Genie CLA 2020-09-03 19:07:18 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 2 Eclipse Genie CLA 2022-11-05 08:14:52 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.