RFR: 8364588: Export the NPE backtracking functionality to general null-checking APIs [v2]

Roger Riggs rriggs at openjdk.org
Tue Aug 5 14:56:03 UTC 2025


On Tue, 5 Aug 2025 14:28:37 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 637:
>> 
>>> 635:     /// Stack offset is the number of non-hidden frames to skip, pointing to the null-checking API.
>>> 636:     /// Search slot is the slot where the null-checked value is passed in.
>>> 637:     NullPointerException extendedNullPointerException(int stackOffset, int searchSlot);
>> 
>> Method should **not** be added to SharedSecrets solely for access by tests.
>> Tests can use @modules to gain access.
>
> This is intended to be an API directly called by future null-check APIs, like `Objects.requireNonNull` or `Checks.nullCheck`. I initially had code for rNN but decided to withhold that for a future patch since it involves CSR and other evaluations not related to this patch's efforts.

Don't add APIs without uses; it speculative and the API may not be what is really needed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26600#discussion_r2254604180


More information about the security-dev mailing list