6908259: Covariance bug for multiple interface inheritence
Maurizio Cimadamore
Maurizio.Cimadamore at Sun.COM
Tue Feb 9 02:10:19 PST 2010
David M. Lloyd wrote:
> I've produced a patch for javac bug #6908259 which appears to fix the
> issue, at first blush. Before engaging in more rigorous testing and
> figuring out how to do this jtreg thing, can someone in the know have
> a glance over this patch and see if it makes any sense?
>
> See http://bugs.sun.com/view_bug.do?bug_id=6908259 for a detailed
> description of the problem.
>
> My attached patch tries to work around the issue by detecting when two
> incompatible methods are both overridden, and if so, it does an extra
> check to see if the overriding method is a valid covariation (?) of
> both methods.
We also have a patch that is currently applied to JDK 7:
http://hg.openjdk.java.net/jdk7/tl/langtools/rev/4a3b9801f7a0
The fix looks a bit more complex than yours (it adds a new method in
check that finds the common covariant overrider in the superclass
hiererachy) - in fact there could be situations in which the last method
in the hierarchy does NOT define the common overrider, as in one of the
regression tests attached above:
class T6294779b {
interface I1<E> {
List<E> m();
}
interface I2<E> {
Queue<E> m();
}
interface I3<E> {
LinkedList<E> m();
}
interface I4<E> extends I1<E>, I2<E>, I3<E> {}
}
In this case, I4 is well-formed as one of the implementing interfaces
--- namely I3 --- is defining a method which is compatible with all
other signatures from I1,I2.
Maurizio
>
> - DML
>
More information about the compiler-dev
mailing list