RFR: Fixing null restricted types for fields/methods in compact source files.
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Jan 16 17:03:07 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.
Good catch!
-------------
Marked as reviewed by mcimadamore (Committer).
PR Review: https://git.openjdk.org/valhalla/pull/1916#pullrequestreview-3671821138
More information about the valhalla-dev
mailing list