Integrated: Fixing null restricted types for fields/methods in compact source files.

Jan Lahoda jlahoda at openjdk.org
Fri Jan 16 19:08:48 UTC 2026


On Thu, 15 Jan 2026 21:21:32 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> The null restricted types don't seem to be supported for top-level fields/methods in compact source files:
> 
> $ cat /tmp/Compact.java 
> String! s = "";
> void main() {
> }
> $ ./build/linux-x86_64-server-release/jdk/bin/javac --enable-preview --source 27 /tmp/Compact.java 
> /tmp/Compact.java:1: error: null restriction not supported in this type context
> String! s = "";
>       ^
> 1 error
> 
> 
> This is a simple patch to fix that (removing the `unannotatedType(boolean)` method, as that is no longer used, to my knowledge. But it can be preserved, if preferred.

This pull request has now been integrated.

Changeset: 1c920be6
Author:    Jan Lahoda <jlahoda at openjdk.org>
Committer: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/1c920be6b1437741b7ec5f7f1bcbaa89e524cbaf
Stats:     23 lines in 2 files changed: 18 ins; 4 del; 1 mod

Fixing null restricted types for fields/methods in compact source files.

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.org/valhalla/pull/1916


More information about the valhalla-dev mailing list