Apparent generics compilation bug new to Java 1.7

Benedict Elliott Smith lists at laerad.com
Thu Feb 23 06:08:03 PST 2012


Hi,

The below class no longer compiles (1.7.02); I can't see any good reason
for it not to, and nor can ecj or the 1.6 JDK, so I think it is quite
probably a bug. Could you confirm I'm not just being an idiot, and I'll
file a bug report? I had a poke around the bug tracker to see if it has
already been filed, but I can't say with confidence it hasn't been.

public class TypeTest {
 static abstract class A<K, V, I extends B<K, V>, I2 extends B<V, K>> {
 abstract A<V, K, I2, I> test();
 }
 static class B<K, V> {
 }
}

javac output is:

TypeTest.java:7: error: type argument I2 is not within bounds of
type-variable I
                abstract A<V, K, I2, I> test();
                                 ^
  where I2,V,K,I are type-variables:
    I2 extends B<V,K> declared in class A
    V extends Object declared in class A
    K extends Object declared in class A
    I extends B<K,V> declared in class A
1 error
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20120223/44b3c71e/attachment.html 


More information about the compiler-dev mailing list