RFR: 8358078: javap crashes with NPE on preview class file [v3]

ExE Boss duke at openjdk.org
Mon Jun 2 20:47:53 UTC 2025


On Mon, 2 Jun 2025 20:06:34 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

>> This change addresses a NPE in javap when trying to print a class with minorVersion != 0. With this change, we fall back to the methods that don't take a `ClassFileFormatVersion` in such case.
>
> Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
> 
>   make test failures easier to read

src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java line 122:

> 120:         if (major < JAVA_1_VERSION || major > ClassFile.latestMajorVersion())
> 121:             // something not representable by CFFV, let's fall back
> 122:             return ClassFileFormatVersion.latest();

For `major < JAVA_1_VERSION`, this should probably return `ClassFileFormatVersion​.RELEASE_0` instead.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25569#discussion_r2122121639


More information about the compiler-dev mailing list