RFR: 8372949: ClassWriter.writeClassAttributes() can throw NPE
Daisuke Yamazaki
dyama at openjdk.org
Sun Dec 7 15:36:52 UTC 2025
Hello maintainers,
This change prevents a possible NPE in [`ClassWriter.writeClassWttributes()`](https://github.com/openjdk/jdk/blob/5f083abafc7abfaa46ddd053668cdfbfd2ad8a87/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java#L891).
[`ConstantPool.getBootstrapMethodAt()`](https://github.com/openjdk/jdk/blob/5f083abafc7abfaa46ddd053668cdfbfd2ad8a87/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java#L479) now returns an empty array instead of `null` when no bootstrap methods are available.
-------------
Commit messages:
- 8372949: Prevent NPE in getBootstrapMethodAt by returning an empty array for null offsets or bootstrap methods
Changes: https://git.openjdk.org/jdk/pull/28690/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28690&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8372949
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/28690.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28690/head:pull/28690
PR: https://git.openjdk.org/jdk/pull/28690
More information about the hotspot-gc-dev
mailing list