VerifyError after JDK-8369654

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P2
    • 26
    • Affects Version/s: 26
    • Component/s: tools

      The following example fails at runtime with a VerifyError after the changes for JDK-8369654 (javac OutOfMemoryError for complex intersection type)

      === ./p/V.java ===
      package p;

      public abstract class V {}
      === ./p/D.java ===
      package p;

      public abstract class D extends V implements Cloneable {}
      === ./p/A.java ===
      package p;

      public class A extends V implements Cloneable {}
      === ./T.java ===
      import p.A;
      import p.D;
      import p.V;

      class T {

        public static void main(String[] args) {
          new T().foo(false, null);
        }

        void foo(boolean b, D d) {
          V u = b ? d : new A();
          g(u);
        }

        void g(V u) {}
      }
      ===

      $ javac T.java p/A.java p/D.java p/V.java

      $ java T
      Error: Unable to initialize main class T
      Caused by: java.lang.VerifyError: Bad type on operand stack
      Exception Details:
        Location:
          T.foo(ZLp/D;)V @18: invokevirtual
        Reason:
          Type 'java/lang/Cloneable' (current frame, stack[1]) is not assignable to 'p/V'
        Current Frame:
          bci: @18
          flags: { }
          locals: { 'T', integer, 'p/D', 'java/lang/Cloneable' }
          stack: { 'T', 'java/lang/Cloneable' }
        Bytecode:
          0000000: 1b99 0007 2ca7 000a bb00 0e59 b700 104e
          0000010: 2a2d b600 11b1
        Stackmap Table:
          same_frame(@8)
          same_locals_1_stack_item_frame(@15,Object[#26])

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: