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

RFE: need source line number info for native/abstract methods in class file

XMLWordPrintable

    • generic
    • generic



      Name: kbR10066 Date: 04/07/2003


      Java compiler does not generate any source code mapping information
      for native and abstract methods. However this information would be desirable for
      debugger/profiler tools. For example, Sun internal Java code coverage tool
      (JCov) is currently unable to locate native/abstract methods in the source due
      to the lack of the requested feature in Javac.

      Since abstract and native methods have no "Code" attribute, they can not have
      usual "LineNumberTable" code's attribute. Instead, some new method-level attribute could be
      introduced for such methods to implement this rfe.

      To reproduce, do the following (see a.java at the bottom):

      1. compile a.java

      % <JDK1.4.2>/javac -Xjcov a.java

      2. decode the class file with JCoder (JCK utility which comes with JavaTest product)

      % java -cp <JavaTest>/binaries/lib/asmtools.jar javasoft.sqe.jdec.Main -g a.class > a.jdec

      3. Look at the a.jdec file, particularly at those pieces which correspond to foo_native and
         foo_abstract methods:
      . . .
          Utf8 "foo_native"; // #9 at 0x53
          Utf8 "foo_abstract"; // #10 at 0x60
      . . .
          { // Member at 0x011B
            0x0109; // access
            #9; // name_cpx
            #5; // sig_cpx
            [0] { // Attributes
            } // Attributes
          } // Member
          ;
          { // Member at 0x0123
            0x0401; // access
            #10; // name_cpx
            #5; // sig_cpx
            [0] { // Attributes
            } // Attributes
          } // Member
        } // methods
      . . .

      It can be seen that these methods do not have any attributes at all.

      --- a.java ---
      public abstract class a {
      public static native void foo_native();

      public abstract void foo_abstract();
      }
      --- end of a.java ---

      ======================================================================

            Unassigned Unassigned
            konstsunw Konst Konst (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: