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

Wrong LineNumberTable for default constructors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7-pool, 8, 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b37
    • Verification:
      Verified

      Backports

        Description

        Given a class containing a method switching on an enum, like this:

        1: public class WeirdConstructorLinenumber
        2: {
        3: public void consider(java.math.RoundingMode mode) {
        4: switch ( mode ) {}
        5: }
        6: }

        javac generates a default constructor as expected.

        But the generated constructor returns from line 4 (which really belongs to the "consider" method).

        $ javac WeirdConstructorLinenumber.java
        $ javap -c -l -classpath . WeirdConstructorLinenumber
        Compiled from "WeirdConstructorLinenumber.java"
        public class WeirdConstructorLinenumber {
          public WeirdConstructorLinenumber();
            Code:
               0: aload_0
               1: invokespecial #1 // Method java/lang/Object."<init>":()V
               4: return
            LineNumberTable:
              line 1: 0
              line 4: 4

           [...]
        }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                mcimadamore Maurizio Cimadamore
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: