Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8033912

StackMapTable breaks methods indentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 8
    • tools
    • 8.0 b126

      Obtain the javap's output that contains a description of several methods with a StackMapTable
      (e.g. "-verbose",
      public class A {
          public void a() {
              for (int i = 0; i < 10; i++) {
                  System.out.println(i);
              }
          }
          public void b() {
              for (int i = 0; i < 10; i++) {
                  System.out.println(i);
              }
          }
          public void c() {
              for (int i = 0; i < 10; i++) {
                  System.out.println(i);
              }
          }
      }
      ).

      Note that the indent of the each subsequent method description is unexpectedly increased:

      Classfile /C:/Work/Javap/ClassFileInfo/build/test/classes/A.class
        Last modified 07.02.2014; size 723 bytes
        MD5 checksum fd26bfc9848cc7b0270c803060db1946
        Compiled from "A.java"
      public class A
        SourceFile: "A.java"
        minor version: 0
        major version: 52
        flags: ACC_PUBLIC, ACC_SUPER
      Constant pool:
         #1 = Methodref #5.#21 // java/lang/Object."<init>":()V
         #2 = Fieldref #22.#23 // java/lang/System.out:Ljava/io/PrintStream;
         #3 = Methodref #24.#25 // java/io/PrintStream.println:(I)V
         #4 = Class #26 // A
         #5 = Class #27 // java/lang/Object
         #6 = Utf8 <init>
         #7 = Utf8 ()V
         #8 = Utf8 Code
         #9 = Utf8 LineNumberTable
        #10 = Utf8 LocalVariableTable
        #11 = Utf8 this
        #12 = Utf8 LA;
        #13 = Utf8 a
        #14 = Utf8 i
        #15 = Utf8 I
        #16 = Utf8 StackMapTable
        #17 = Utf8 b
        #18 = Utf8 c
        #19 = Utf8 SourceFile
        #20 = Utf8 A.java
        #21 = NameAndType #6:#7 // "<init>":()V
        #22 = Class #28 // java/lang/System
        #23 = NameAndType #29:#30 // out:Ljava/io/PrintStream;
        #24 = Class #31 // java/io/PrintStream
        #25 = NameAndType #32:#33 // println:(I)V
        #26 = Utf8 A
        #27 = Utf8 java/lang/Object
        #28 = Utf8 java/lang/System
        #29 = Utf8 out
        #30 = Utf8 Ljava/io/PrintStream;
        #31 = Utf8 java/io/PrintStream
        #32 = Utf8 println
        #33 = Utf8 (I)V
      {
        public A();
          descriptor: ()V
          flags: ACC_PUBLIC
          Code:
            stack=1, locals=1, args_size=1
               0: aload_0
               1: invokespecial #1 // Method java/lang/Object."<init>":()V
               4: return
            LineNumberTable:
              line 7: 0
            LocalVariableTable:
              Start Length Slot Name Signature
                  0 5 0 this LA;

        public void a();
          descriptor: ()V
          flags: ACC_PUBLIC
          Code:
            stack=2, locals=2, args_size=1
               0: iconst_0
               1: istore_1
               2: iload_1
               3: bipush 10
               5: if_icmpge 21
               8: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
              11: iload_1
              12: invokevirtual #3 // Method java/io/PrintStream.println:(I)V
              15: iinc 1, 1
              18: goto 2
              21: return
            LineNumberTable:
              line 9: 0
              line 10: 8
              line 9: 15
              line 12: 21
            LocalVariableTable:
              Start Length Slot Name Signature
                  2 19 1 i I
                  0 22 0 this LA;
            StackMapTable: number_of_entries = 2
                 frame_type = 252 /* append */
                offset_delta = 2
                locals = [ int ]
                   frame_type = 250 /* chop */
                  offset_delta = 18


          public void b();
            descriptor: ()V
            flags: ACC_PUBLIC
            Code:
              stack=2, locals=2, args_size=1
                 0: iconst_0
                 1: istore_1
                 2: iload_1
                 3: bipush 10
                 5: if_icmpge 21
                 8: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
                11: iload_1
                12: invokevirtual #3 // Method java/io/PrintStream.println:(I)V
                15: iinc 1, 1
                18: goto 2
                21: return
              LineNumberTable:
                line 14: 0
                line 15: 8
                line 14: 15
                line 17: 21
              LocalVariableTable:
                Start Length Slot Name Signature
                    2 19 1 i I
                    0 22 0 this LA;
              StackMapTable: number_of_entries = 2
                   frame_type = 252 /* append */
                  offset_delta = 2
                  locals = [ int ]
                     frame_type = 250 /* chop */
                    offset_delta = 18


            public void c();
              descriptor: ()V
              flags: ACC_PUBLIC
              Code:
                stack=2, locals=2, args_size=1
                   0: iconst_0
                   1: istore_1
                   2: iload_1
                   3: bipush 10
                   5: if_icmpge 21
                   8: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
                  11: iload_1
                  12: invokevirtual #3 // Method java/io/PrintStream.println:(I)V
                  15: iinc 1, 1
                  18: goto 2
                  21: return
                LineNumberTable:
                  line 19: 0
                  line 20: 8
                  line 19: 15
                  line 22: 21
                LocalVariableTable:
                  Start Length Slot Name Signature
                      2 19 1 i I
                      0 22 0 this LA;
                StackMapTable: number_of_entries = 2
                     frame_type = 252 /* append */
                    offset_delta = 2
                    locals = [ int ]
                       frame_type = 250 /* chop */
                      offset_delta = 18

            }

            jjg Jonathan Gibbons
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: