I just installed jdk1.7.0_07 and I'm suddenly inundated with lots of warnings about generic raw types. (I'm getting hundreds of them and they obfuscate other, possibly meaningful warnings.) To the best of my knowledge these errors should not be generated and I didn't get them with java-6-openjdk-i386.
I've created the following minor example. (Each class is in its own file.)
public interface Generic<T> {
public T get( );
}
public class Test {
public Test safeAsHell( Generic thing, int number ) {
return new Test( );
}
public void safeAsHell( Generic thing ) { }
}
When I try to compile this (javac -Xlint), I get the following warnings:
Test.java:3: warning: [rawtypes] found raw type: Generic
public Test safeAsHell( Generic thing, int number ) {
^
missing type arguments for generic class Generic<T>
where T is a type-variable:
T extends Object declared in interface Generic
Test.java:7: warning: [rawtypes] found raw type: Generic
public void safeAsHell( Generic thing ) { }
^
missing type arguments for generic class Generic<T>
where T is a type-variable:
T extends Object declared in interface Generic
2 warnings
Adding Object
as a generic type parameter (Generic<Object> thing
) solves the problem. I'd have thought the types Generic
and Generic<Object>
are equivalent. Am I overlooking something?