FULL PRODUCT VERSION :
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
A DESCRIPTION OF THE PROBLEM :
Trying to compile this code:
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
I get an error:
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a file ComplexHierarchy.java with the following contents:
=====
package data;
public class ComplexHierarchy {
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
}
====
Try to compile. Get the error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error should be reported (according to my understanding of the JLS)
ACTUAL -
Error:
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
ERROR MESSAGES/STACK TRACES THAT OCCUR :
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package data;
public class ComplexHierarchy {
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use ecj
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
A DESCRIPTION OF THE PROBLEM :
Trying to compile this code:
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
I get an error:
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a file ComplexHierarchy.java with the following contents:
=====
package data;
public class ComplexHierarchy {
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
}
====
Try to compile. Get the error
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error should be reported (according to my understanding of the JLS)
ACTUAL -
Error:
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
ERROR MESSAGES/STACK TRACES THAT OCCUR :
types data.B and data.A are incompatible; both define getIt(), but with unrelated return types
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package data;
public class ComplexHierarchy {
public interface A {
A getIt();
}
public interface B {
B getIt();
}
public interface C extends A, B {
@Override
C getIt();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use ecj