NPE in javap
Chen Liang
chen.l.liang at oracle.com
Fri Aug 8 23:01:02 UTC 2025
Thanks for the report. This is known as https://bugs.openjdk.org/browse/JDK-8364095, and the proper modeling of preview features is pending on https://github.com/openjdk/jdk/pull/25017.
Chen
________________________________
From: valhalla-dev <valhalla-dev-retn at openjdk.org> on behalf of Remi Forax <forax at univ-mlv.fr>
Sent: Friday, August 8, 2025 5:53 PM
To: valhalla-dev <valhalla-dev at openjdk.org>
Subject: NPE in javap
This class throw an NPE in javap:
public value class RangeValue {
private int min;
private int max;
public RangeValue(int a, int b) {
if (a > b) {
this.min = b;
this.max = a;
} else {
this.min = a;
this.max = b;
}
super();
}
public int min() {
return min;
}
public int max() {
return max;
}
}
The stacktrace seems to say that ACC_STRICT (on fields) is not supported.
Rémi
---
bash-3.2$ $JAVA_HOME/bin/javap -c -verbose -private target/classes/RangeValue.class
Classfile /Users/forax/git/weather-alert/target/classes/RangeValue.class
Last modified 9 Aug 2025; size 549 bytes
SHA-256 checksum 10fcbe0722123c3576c1c9a4814180d3a436510b09c8308083b47b7bfe23d1bd
Compiled from "RangeValue.java"
public final value class RangeValue
minor version: 65535
major version: 69
flags: (0x0011) ACC_PUBLIC, ACC_FINAL
this_class: #2 // RangeValue
super_class: #11 // java/lang/Object
interfaces: 0, fields: 2, methods: 3, attributes: 1
Constant pool:
#1 = Fieldref #2.#3 // RangeValue.min:I
#2 = Class #4 // RangeValue
#3 = NameAndType #5:#6 // min:I
#4 = Utf8 RangeValue
#5 = Utf8 min
#6 = Utf8 I
#7 = Fieldref #2.#8 // RangeValue.max:I
#8 = NameAndType #9:#6 // max:I
#9 = Utf8 max
#10 = Methodref #11.#12 // java/lang/Object."<init>":()V
#11 = Class #13 // java/lang/Object
#12 = NameAndType #14:#15 // "<init>":()V
#13 = Utf8 java/lang/Object
#14 = Utf8 <init>
#15 = Utf8 ()V
#16 = Utf8 (II)V
#17 = Utf8 Code
#18 = Utf8 LineNumberTable
#19 = Utf8 LocalVariableTable
#20 = Utf8 this
#21 = Utf8 LRangeValue;
#22 = Utf8 a
#23 = Utf8 b
#24 = Utf8 StackMapTable
#25 = Utf8 ()I
#26 = Utf8 SourceFile
#27 = Utf8 RangeValue.java
{
Error: A serious internal error has occurred: java.lang.NullPointerException
Please file a bug report, and include the following information:
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:318)
at java.base/java.lang.reflect.AccessFlag$Location.findInHistory(AccessFlag.java:671)
at java.base/java.lang.reflect.AccessFlag$Location.flagsMask(AccessFlag.java:707)
at jdk.jdeps/com.sun.tools.javap.BasicWriter.maskToAccessFlagsReportUnknown(BasicWriter.java:66)
at jdk.jdeps/com.sun.tools.javap.BasicWriter.flagsReportUnknown(BasicWriter.java:58)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.writeField(ClassWriter.java:437)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.writeFields(ClassWriter.java:428)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.write(ClassWriter.java:261)
at jdk.jdeps/com.sun.tools.javap.JavapTask.write(JavapTask.java:859)
at jdk.jdeps/com.sun.tools.javap.JavapTask.writeClass(JavapTask.java:684)
at jdk.jdeps/com.sun.tools.javap.JavapTask.run(JavapTask.java:628)
at jdk.jdeps/com.sun.tools.javap.JavapTask.run(JavapTask.java:474)
at jdk.jdeps/com.sun.tools.javap.Main.main(Main.java:48)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20250808/8840db74/attachment.htm>
More information about the valhalla-dev
mailing list