Bug in javac ?

Deepak Bhole dbhole at redhat.com
Mon Oct 31 16:00:01 UTC 2011


* Christoph Höger <christoph.hoeger at tu-berlin.de> [2011-10-31 11:37]:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> I am really unsure here, if this is a javac bug, or an eclipse glitch
> or something plain strange. Consider the following interfaces:
> 
> public interface A {
>     A foo();
> }
> 
> public interface B {
>     B foo();
> }
> 
> public interface C extends A, B {
>     @Override
>     C foo();
> }
> 
> Eclipse _does_ compile those interfaces. If you comment out C foo(),
> it (rightfully IMO) complains.
> javac does _not_ compile those interfaces and (IMO erroneously)
> complains about incompatible super interfaces.
> 
> Any ideas who is wrong?
>

It looks like a known bug in the 6 compiler related to interface
inheritance and covariant return types. I think this is the commit
that fixed it in 7:

http://hg.openjdk.java.net/jdk7/jdk7/langtools/rev/4a3b9801f7a0
 
If you have code that resembles the above and would like to see the fix
backported to 6, please feel free to open a bug.

Cheers,
Deepak


More information about the devel mailing list