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

Johan Sjölen jsjolen at openjdk.org
Tue Aug 5 10:23:07 UTC 2025


On Fri, 1 Aug 2025 15:49:57 GMT, Chen Liang <liach at openjdk.org> wrote:

> Provide a general facility for our null check APIs like Objects::requireNonNull or future Checks::nullCheck (void), converting the existing infrastructure to start tracking from a given stack site (depth offset) and a given stack slot (offset value).

Still reading this. A few comments, mostly intended to make this easier to grok for future readers. The actual logic seems fine from a first read.

src/java.base/share/classes/java/lang/NullPointerException.java line 159:

> 157:     ///    configurations to trace how a particular argument, which turns out to
> 158:     ///    be `null`, was evaluated.
> 159:     /// 2. `searchSlot < 0`, stack offset is 0 (a call to the nullary constructor)

Can `searchSlot == -1` here?

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

PR Review: https://git.openjdk.org/jdk/pull/26600#pullrequestreview-3087588630
PR Review Comment: https://git.openjdk.org/jdk/pull/26600#discussion_r2253882841


More information about the security-dev mailing list