RFR: 8294969: Convert jdk.jdeps javap to use the Classfile API
Chen Liang
liach at openjdk.org
Mon Apr 17 13:47:03 UTC 2023
On Tue, 29 Nov 2022 10:26:31 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
I took a look at this patch locally; 4 of the javap tests fail. The main problem with this port is that javap has in-depth constant pool error handling; for instance, if an interface list is broken with some invalid class entries, the old library allows to report the valid entries, while classfile api just interprets the whole interface list at once and fails with IllegalArgumentException or IndexOutOfBoundsException for invalid constant pool indices. It's quite complicated to safeguard every potentially erroneous call.
test/langtools/tools/javap/TestClassNameWarning.java line 180:
> 178: cf.magic, cf.minor_version, cf.major_version, cf.constant_pool,
> 179: cf.access_flags,
> 180: cf.this_class,
Should we just remove this no-name-class case since it's already an invalid class file?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/11411#issuecomment-1493109566
PR Review Comment: https://git.openjdk.org/jdk/pull/11411#discussion_r1158595266
More information about the core-libs-dev
mailing list