RFR: 8364588: Export the NPE backtracking functionality to general null-checking APIs [v4]
David Holmes
dholmes at openjdk.org
Wed Aug 6 07:01:06 UTC 2025
On Tue, 5 Aug 2025 10:16:32 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> src/hotspot/share/interpreter/bytecodeUtils.cpp line 1483:
>>
>>> 1481: // Is an explicit slot given?
>>> 1482: bool explicit_search = slot >= 0;
>>> 1483: if (explicit_search) {
>>
>> Suggestion:
>>
>> if (slot >= 0) {
>>
>> No need for the temporary local.
>
> If we don't adopt the enum I suggested, then I do prefer the naming of the condition through a variable. It gives you a hint of what the check is looking for, and not only what the check does.
That is what comments are for.
>> src/java.base/share/classes/java/lang/NullPointerException.java line 78:
>>
>>> 76: NullPointerException(int stackOffset, int searchSlot) {
>>> 77: extendedMessageState = setupCustomBackTrace(stackOffset, searchSlot);
>>> 78: this();
>>
>> I thought `this()` had to come first in a constructor? Is this new in 25 or 26?
>
> https://openjdk.org/jeps/492
And now final - https://openjdk.org/jeps/513
Thanks
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26600#discussion_r2256053422
PR Review Comment: https://git.openjdk.org/jdk/pull/26600#discussion_r2256047794
More information about the security-dev
mailing list