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

Chen Liang liach at openjdk.org
Fri Aug 8 18:54:13 UTC 2025


On Tue, 5 Aug 2025 14:11:06 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update NPE per roger review
>
> src/java.base/share/classes/java/lang/NullPointerException.java line 142:
> 
>> 140:     }
>> 141: 
>> 142:     // Methods below must be called in object monitor
> 
> This kind of warning should be on every method declaration, if separated from the method doc, it can be overlooked by future maintainers.

Done.

> src/java.base/share/classes/java/lang/NullPointerException.java line 146:
> 
>> 144:     private void ensureMessageComputed() {
>> 145:         if ((extendedMessageState & (MESSAGE_COMPUTED | CONSTRUCTOR_FINISHED)) == CONSTRUCTOR_FINISHED) {
>> 146:             int stackOffset = (extendedMessageState & STACK_OFFSET_MASK) >> STACK_OFFSET_SHIFT;
> 
> This would be more readable if private utility methods were added that encapsulated the shift and masking, both for extraction and construction.

Done.

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

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


More information about the security-dev mailing list