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

wrong debugging lineno information for final fields

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.4
    • Not verified

      The line number information in debugging line table of class file is
      wrong for the instruction generated from final constant fields.
      Actually the line number of declaration is used instead of the line
      number of reference (see example below).

      The instruction "iconst_2" (address 18) has lineno 2
      in line table. It should be line 8.

      -----------------t.java--------------
      public class t {
      public final int TWO = 2;
      void f() {
      int a = 1;
      a += 1;
      System.out.println(a);
      a += TWO;
      System.out.println(TWO);
      a += 3;
      }
      }
      --------------------------------------
      > /usr/local/java/1.0/bin/javac -g t.java
      > /usr/local/java/1.0/bin/javap -c -l t
      ...
      Line numbers for method void f()
         line 4: 0
         line 5: 2
         line 6: 5
         line 7: 12
         line 8: 15
         line 2: 18<----????
         line 8: 19
         line 9: 22
         line 3: 25
      Method void f()
         0 iconst_1
         1 istore_1
         2 iinc 1 1
         5 getstatic #8 <Field java.lang.System.out Ljava/io/PrintStream;>
         8 iload_1
         9 invokevirtual #6 <Method java.io.PrintStream.println(I)V>
        12 iinc 1 2
        15 getstatic #8 <Field java.lang.System.out Ljava/io/PrintStream;>
        18 iconst_2
        19 invokevirtual #6 <Method java.io.PrintStream.println(I)V>
        22 iinc 1 3
        25 return

            jrose John Rose
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: