Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339173 - [quick fix] "Infer Generic type arguments" quick fix is not useful
Summary: [quick fix] "Infer Generic type arguments" quick fix is not useful
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 03:24 EST by Deepak Azad CLA
Modified: 2011-03-09 12:06 EST (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 Deepak Azad CLA 2011-03-08 03:24:17 EST
----------------------------------------------------------------------------
package p;

import java.util.Arrays;
import java.util.Comparator;

class A {
	void bar(Integer a[], int b[]) {
		Arrays.sort(a, new Comparator() { // ctrl+1 on this line

			@Override
			public int compare(Object object1, Object object2) {
				// TODO Auto-generated method stub
				return 0;
			}
		});
	}
}
----------------------------------------------------------------------------
- Place caret in "new Comparator()"
  OR
  Select "Type safety: The expression of type new Comparator(){} needs unchecked conversion to conform to Comparator<? super Integer>" in problems view
- Crtl+1
- Select "Infer Generic type arguments"
=> the refactoring does not change anything

The same can also be seen in org.eclipse.jdt.internal.ui.dialogs.TypeInfoViewer line 716, where the refactoring results in some changes but on other lines in the file.
Comment 1 Deepak Azad CLA 2011-03-08 03:24:47 EST
Build id is I20110307-2110.
Comment 2 Markus Keller CLA 2011-03-09 12:06:49 EST
Unfortunately, it's very hard to find out when the Infer Generic Type Arguments refactoring will not be able to fix the problems, so I think we have to live with that.

See bug 338404 for a solution tailored to this specific problem.