Bug 241036 - [pull up] pull up causes compile error in case of generic methods calls
Summary: [pull up] pull up causes compile error in case of generic methods calls
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-15 22:50 EDT by Hoon Kim CLA
Modified: 2022-11-05 08:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.