Generics and Error Highlighting...


here is another thing I don't exactly understand:

Class<? super Object> objectClass2 = String.class;

Is not highlighted as error.
Okay - this statement isn't very intelligent, but...

Johannes Schneider

1 comment
Comment actions Permalink

This is a bug.

To enjoy generics fully you may also try to simulate type checking in the following example:

interface C {} class Weird { >> void f(C super V>]]> p1, V p2){
p1 = p2;

Please do not post the bug to Sun, they have already fixed it in Mustang (though I managed to invent this example by myself:)). I still wonder what are the JLS rules for this...


Please sign in to leave a comment.