RFR: 8294969: Convert jdk.jdeps javap to use the Classfile API [v11]

Vicente Romero vromero at openjdk.org
Thu Sep 7 17:18:56 UTC 2023


On Thu, 20 Jul 2023 09:11:20 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> javap uses proprietary com.sun.tools.classfile library to parse class files.
>> 
>> This patch converts javap to use Classfile API.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 227 commits:
> 
>  - Merge branch 'master' into JDK-8294969-javap
>  - Merge branch 'master' into JDK-8294969-javap
>  - fixed code printing and ConstantPoolException reporting indoex
>  - added DydnamicConstantPoolEntry::bootstrapMethodIndex
>    fix of javap ConstantWriter to print DynamicConstantPoolEntry without accessing BSM attribute
>  - extended ClassReader about specific entry-reading methods to avoid class cast and throw ConstantPoolException instead
>  - throwing ConstantPoolException for invalid BSM entry index
>  - Merge branch 'master' into JDK-8294969-javap
>  - fixed JavapTask
>  - Merge branch 'master' into JDK-8294969-javap
>  - Merge branch 'master' into JDK-8294969-javap
>    
>    # Conflicts:
>    #	src/java.base/share/classes/jdk/internal/classfile/constantpool/ConstantPoolException.java
>  - ... and 217 more: https://git.openjdk.org/jdk/compare/37c756a7...4960751b

src/java.base/share/classes/jdk/internal/classfile/ClassReader.java line 226:

> 224: 
> 225:     /**
> 226:      * {@return the field ref entry whose index is given at the specified

I think that `ref` in these APIs should be `reference`

src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java line 465:

> 463:                 indent(+1);
> 464:                 print("target_platform: #" + attr.targetPlatform().index());
> 465: //ToDo find the spec - can be null???

what about this comment?

src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java line 549:

> 547:             case SourceIDAttribute attr ->
> 548:                 constantWriter.write(attr.sourceId().index());
> 549: //            case StackMapAttribute ???

I guess this comment can be removed

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/11411#discussion_r1318036242
PR Review Comment: https://git.openjdk.org/jdk/pull/11411#discussion_r1318069041
PR Review Comment: https://git.openjdk.org/jdk/pull/11411#discussion_r1318070357


More information about the compiler-dev mailing list