JDK-8013089 : javac fails to generate bridge for override with reordered intersection
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2013-04-23
  • Updated: 2016-10-03
  • Resolved: 2016-10-03
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
 public static class Sup {
   <T extends Runnable & Cloneable> void m(T arg) { System.out.println("Sup"); }
 }
 public static class Sub extends Sup {
   <T extends Cloneable & Runnable> void m(T arg) { System.out.println("Sub"); }
 }

Internally, the compiler treats this as an override.  But the generated code includes Sup.m(Runnable)V and Sub.m(Cloneable)V, with no bridge between them.

ecj 3.8 has the same typing logic, but does generate a bridge.

Another possible (source-incompatible) approach is to decide that the two intersections are _not_ the same, so no overriding occurs.  JLS is not extremely clear on this.

Comments
Was reported and fixed independently in JDK-8166363.
03-10-2016