RFR: add use site null checks

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jan 15 09:45:42 UTC 2026


On Thu, 15 Jan 2026 05:46:52 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> Adding use site null checks for method invocations. They are added by default but if option: `noUseSiteNullChecks` is passed, the compiler won't generate them

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/NullChecksWriter.java line 194:

> 192:     private List<JCExpression> newArgs(Symbol.MethodSymbol msym, List<JCExpression> actualArgs) {
> 193:         List<Type> declaredArgTypes = msym.type.asMethodType().argtypes;
> 194:         int externalArgsLength = msym.externalType(types).getParameterTypes().size() - declaredArgTypes.size();

Maybe calling this `prefixArgs` is more true to what this is (e.g. these are arguments added by Lower that should never be null.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1910#discussion_r2693671927


More information about the valhalla-dev mailing list