Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 167467 - Quickfix behavior for generic static methods is incomplete
Summary: Quickfix behavior for generic static methods is incomplete
Status: RESOLVED DUPLICATE of bug 167468
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-11 14:07 EST by Luke Hutchison CLA
Modified: 2006-12-11 14:21 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Hutchison CLA 2006-12-11 14:07:52 EST
Consider this class:

public class Tmp {
	public static void test(int a) {
		test(a, a);   // error here
	}
}

Quickfix on the commented line offers the choices:
  - Remove argument to match "test(int)"
  - Change method "test(int)": add argument "int" 
  - Create method "test(int,int)"
  - Rename in file

This is correct.  Choosing "Create method" and then adding the following:

	private static void test(int a, int a2) {
		test(a, a, a);  // new error here
	}

Now trying quick fix on the new error line, I get one remove and one change method option for each version of test(), and one Create Method option.  This is also correct.

However the same options don't apply for the following:

public class Tmp {
	public static <T> void test(T a) {
		test(a, a);
	}
}

Specifically I don't get the "Create method test(T, T)" option.

Manually creating this method:

	public static <T> void test(T a, T b) {
		test(a, a, a);  // new error here
	}

I also don't get the "Create method test(T, T, T)" option here.  But this has other problems.  It only gives one set of "Add parameter" and "Remove parameter" options, rather than two.  Also it is arbitrary as to which version of test() is listed as the option that you can add parameters to or remove them from.  (It seems that it is whatever version of the method that most closely matches the call to the non-existent method.  In some cases it will match test(T) and in other cases test(T,T), depending on what the actual types are, for more complex examples than what is given here.)
Comment 1 Luke Hutchison CLA 2006-12-11 14:21:39 EST
Sorry, hit submit twice.

*** This bug has been marked as a duplicate of bug 167468 ***