RFR: Downgrade subtyping/cast failures from errors to warnings
Vicente Romero
vromero at openjdk.org
Thu Jan 8 22:34:29 UTC 2026
On Thu, 8 Jan 2026 19:11:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This PR reverts all changes to subtyping and cast conversion, meaning that assigning `null` to a null-restricted type is no longer an error.
>> I've resurrected the lint `null` category, to issue a warning in such cases.
>>
>> There's some stuff left to do, as I realized that the compiler swallows null markers when emitting diagnostics. This is due to a conundrum in the diagnostic formatter calling `stripMetadata`, and that resulting in _all_ metadata (not just type annos) to be lost.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties line 4390:
>
>> 4388: compiler.warn.suspicious.nullness.conversion=\
>> 4389: Suspicious nullness conversion\n\
>> 4390: required: {0}!\n\
>
> Note the `!` here -- it's an hack, since the compiler swallows it :-(
hehe, good one
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1872#discussion_r2674126601
More information about the valhalla-dev
mailing list