Community
Participate
Working Groups
I suggest to add a Quick Fix: "add generic parameter to class type" when invoked over piece of code like this: public class Test { Class<String> get() { return null; } void foo() { // WARNING: Class is a raw type. // References to generic type Class<T> should be parameterized Class c = get(); // <--- warning } } Solution is to convert line with warning to "Class<String> c = get();" and Eclipse can easily infer what the type should be from the right side of the expression. I'm just converting large piece of code to generics and most if not all of cases could be solved by quick fix like this.
That's already fixed in the latest
I'm afraid that latest changes are not what this bug report was about or they don't work properly. Current Eclipse is unable to fix the above example. I would expect that quick fix can detect that proper type of Class should be String, instead: - 'Add type parameter to Class' suggest two options: ? and Object - 'Infer Generic Type Arguments' does nothing or adds <?> type to Class (depending on the user interface option selected) Additionally, problem with the latter is that it works on entire file instead of just single problem (like all other Quick Fix-es seem to do). Problem with this is that, in complicated code, each such correction need to be reviewed individually (which is currently impossible). Saving file before/after each fix is also time-consuming. Tested with: Version: 3.2.0 Build id: I20060221-1300
Sorry, you're right, it does not work. But it's a dup. *** This bug has been marked as a duplicate of 124848 ***