On Wed, 21 Jan 2026 00:43:37 GMT, Vicente Romero <[email protected]> wrote:

> Changing the option to indicate if use site null checks should be emitted for 
> fields and methods. The option has be renamed to: `useSiteNullChecks` with 
> sub-options to indicate if no use site checks should be generated, or if it 
> should be generated only for methods or for methods and fields. The default 
> is generating the checks for fields and methods

Looks good -- I left a stylistic/cleanup suggestion

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

> 93:         } else {
> 94:             useSiteNullChecks = switch (opt) {
> 95:                 case "none" -> UseSiteNullChecks.NONE;

You could make the code a bit tighter by moving the names like "none" etc. 
inside the Enum (e.g. each constant has its own name). Then you can have an 
enum factory that takes a String (the javac option value) and returns the 
corresponding enum, if any is found. We use that pattern elsewhere in javac

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

Marked as reviewed by mcimadamore (Committer).

PR Review: 
https://git.openjdk.org/valhalla/pull/1939#pullrequestreview-3686477700
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1939#discussion_r2711947688

Reply via email to