JDK-8049305 : Verification error due to a bad stackmap frame generated by javac
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7u45,8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Withdrawn
  • Submitted: 2014-07-03
  • Updated: 2014-08-29
  • Resolved: 2014-07-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b24Resolved
Related Reports
Relates :  
Relates :  
Description
The following test case causes verification errors. This is the simplest
possible test case to recreate the issue.

public class BugDemo {
    int jj_ntk;

        public static void main(String[] args) {
        BugDemo bd = new BugDemo();
                bd.jj_ntk = args.length;
                bd.foo();
        }

        final public void foo(){
                while (true) {
                        int i =0;
                        switch (jj_ntk) {
                                case 1:
                                        break;
                                default: ;
                        }
                        break;
                }

                switch (jj_ntk) {
                        case 1:
                                A j2 = (A)A.create(this);
                                break;
                        default:
                                swap();
                }
  }

        public int jj_ntk() {
                return jj_ntk;
        }
       
        public void swap() {
             jj_ntk = (jj_ntk == 1)? 0:1;
        }
}

class A {
    public static A create(Object obj) {
              return new A();
         }
}

Comments
We will continue work on JDK-8050386
15-07-2014

smaller test case: public class BugDemo { public static void main(String[] args) { foo(); } static void foo(){ while (true) { int i = 0; break; } switch (1) { case 1: int j = 0; case 2: bar(); } } static void bar() {} }
11-07-2014

javap ouput for code above: public static final void foo(); descriptor: ()V flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL Code: stack=2, locals=2, args_size=0 0: lconst_0 1: lstore_0 2: goto 5 5: iconst_1 6: lookupswitch { // 1 1: 24 default: 28 } 24: invokestatic #3 // Method A.create:()LA; 27: astore_0 28: invokestatic #4 // Method swap:()V 31: return LineNumberTable: line 8: 0 line 9: 2 line 11: 5 line 13: 24 line 15: 28 line 17: 31 StackMapTable: number_of_entries = 4 frame_type = 0 /* same */ frame_type = 4 /* same */ frame_type = 18 /* same */ frame_type = 252 /* append */ offset_delta = 3 locals = [ class A ] last append frame is incorrect, it should be a same_frame.
10-07-2014