FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000
5.00.2195
Service Pack 4
A DESCRIPTION OF THE PROBLEM :
Super does not seem able to accept a named parameter type... method bar4() below does not compile.
public class Foo<T> {
// These are all OK
void bar1(Class<? extends T> x) {}
<X extends T> void bar2(Class<X> x) {}
void bar3(Class<? super T> x) {}
// but this one causes javac to complain... why?
<X super T> void bar4(Class<X> x) {}
public static void main(String[] args) {
Foo<Number> f = new Foo<Number>();
f.bar1(Integer.class);
f.bar2(Double.class);
f.bar3(Object.class);
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to compile code snippet above, see error.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expected it to compile, and for <X super T> to work similarly to <X extends T>
ACTUAL -
won't compile
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Foo.java:8: > expected
<X super T> void bar4(Class<X> x) {}
^
Foo.java:12: illegal start of type
f.bar1(Integer.class);
^
etc.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Foo<T> {
// These are all OK
void bar1(Class<? extends T> x) {}
<X extends T> void bar2(Class<X> x) {}
void bar3(Class<? super T> x) {}
// but this one causes javac to complain... why?
<X super T> void bar4(Class<X> x) {}
public static void main(String[] args) {
Foo<Number> f = new Foo<Number>();
f.bar1(Integer.class);
f.bar2(Double.class);
f.bar3(Object.class);
}
}
---------- END SOURCE ----------
###@###.### 10/21/04 17:04 GMT