Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9499

VerifyError when AIC used as argument to special constructor call

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-beta-2, 2.5.13
    • None
    • None

    Description

      Consider the following:

      class C {
        C(ref) {
          println ref.hashCode()
        }
      }
      class D extends C {
        D() {
          super(new Object() { // AIC before special ctor call completes
          })
        }
      }
      
      new D()
      

      Supplying an AIC to the super constructor results in a verify error for an uninitialized-this reference. In this case, the AIC should not be built to expect a reference to an instance of the enclosing class since it is being executed in a static context.

      Caught: java.lang.VerifyError: Bad type on operand stack
      Exception Details:
        Location:
          D.<init>()V @6: invokespecial
        Reason:
          Type uninitializedThis (current frame, stack[3]) is not assignable to 'D'
        Current Frame:
          bci: @6
          flags: { flagThisUninit }
          locals: { uninitializedThis }
          stack: { uninitializedThis, uninitialized 1, uninitialized 1, uninitializedThis }
        Bytecode:
          0x0000000: 2abb 000d 592a b700 10b7 0013 b1 
      

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h