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

Display javap LineNumberTable and LocalVariableTable iff disassembled code output with `-c` or `-v`

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 24
    • None
    • tools
    • None
    • b27

      `javap -l EmptyLoop` currently outputs the LineNumberTable/LocalVariableTable, even without the `-c` flag. This means there is output, which references instructions and lines of code, for which there is no context.

      I propose to remove this output, thereby coupling the `-c` and `-l` flag. For the `-l` without `-c` case I propose outputting a warning and no LineNumberTable/LocalVariableTable information.

      This proposal stems from discussion in: https://github.com/openjdk/jdk/pull/22359


      Example for `javap -l EmptyLoop`

      ```
      Compiled from "EmptyLoop.java"
      public class EmptyLoop {
        public EmptyLoop();
          Code:
            LineNumberTable:
              line 1: 0

        public void emptyLoop();
          Code:
            LineNumberTable:
              line 3: 0
              line 5: 14
      }
      ```

            jlamperth Jonathan Lampérth
            jlamperth Jonathan Lampérth
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: