RFR: 8035271: Incorrect indentation of LineNumberTable/LocalVariableTable/Exception table/LocalVariableTypeTable/StackMapTable/RuntimeVisibleTypeAnnotations in verbose mode [v2]
Jonathan Lampérth
duke at openjdk.org
Tue Nov 26 08:57:04 UTC 2024
> Very similar and related to: https://bugs.openjdk.org/browse/JDK-8034066
>
> This PR includes changes to ensure the indentation of `LineNumberTable` and `LocalVariableTable` behave in the same way both for the `javap -verbose` and `javap -l -c` case. Prior to this PR, for the `javap -l -c` case the `LineNumberTable` and `LocalVariableTable` attributes are not indented with regard to the `Code: ` header.
>
> The only case, where no extra indentation is added is for `javap -l` without `-c` -- As it does not make sense to indent if there is no `Code:` header to indent relative to. I am not sure if there is a use case for `-l` without `-c`, but would leave this functionality as is.
>
> ## Current behaviour of javap previously differed with and without -verbose in the following way:
>
> ### Case: `javap -l -c EmptyLoop.class`
>
>
> ...
> public void emptyLoop();
> Code:
> 0: iconst_0
> ...
> 14: return
> LineNumberTable:
> line 3: 0
> line 5: 14
> ...
>
>
> ### Case: `javap -verbose EmptyLoop.class`
>
>
> ...
> public void emptyLoop();
> descriptor: ()V
> flags: (0x0001) ACC_PUBLIC
> Code:
> stack=2, locals=2, args_size=1
> 0: iconst_0
> ...
> 14: return
> LineNumberTable:
> line 3: 0
> line 5: 14
> ...
>
>
> ## New behaviour:
> ### Case: `javap -l -c EmptyLoop.class`
>
> ...
> public void emptyLoop();
> Code:
> 0: iconst_0
> ...
> 14: return
> LineNumberTable:
> line 3: 0
> line 5: 14
> ...
>
>
>
> ## Open Questions
> ### Add code header for only `-l` case?
> Currently for `-l` without `-c` things look as follows:
>
>
> ...
> public void emptyLoop();
> LineNumberTable:
> line 3: 0
> line 5: 14
> ...
>
>
> One could also imagine making the output:
>
> ...
> public void emptyLoop();
> Code:
> LineNumberTable:
> line 3: 0
> line 5: 14
> ...
Jonathan Lampérth has updated the pull request incrementally with one additional commit since the last revision:
feat: add Code: header for LNT and LVT
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22359/files
- new: https://git.openjdk.org/jdk/pull/22359/files/35fbd3f8..68ec9aaa
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22359&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22359&range=00-01
Stats: 83 lines in 3 files changed: 22 ins; 49 del; 12 mod
Patch: https://git.openjdk.org/jdk/pull/22359.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22359/head:pull/22359
PR: https://git.openjdk.org/jdk/pull/22359
More information about the core-libs-dev
mailing list