pkl-core: Migrate nullness to JSpecify (#1601)

Replace pkl-core's local nullness annotations with JSpecify annotations.
Enable NullAway checking for pkl-core packages except org.pkl.core.ast
and org.pkl.core.stdlib.

Notable code changes:
- Add a dedicated late-init constructor to VmTyped
- Move VmExceptionBuilder's fallback message derivation from withCause()
to build()
- Split VmException rendering between builder-provided messages and
string-backed messages
- Initialize MessageTransport handlers with default throwing handlers
- Update JSON helper collection types to allow nullable values JSON
arrays and objects can contain JSON null,
so the Java Map/List element types need to model nullable elements
explicitly
- Make public command transform APIs accept nullable transformed values 
   Command transforms can produce null for optional/default handling,
so the BiFunction and options-map element types now model that
explicitly
- Make ExecutorSpiException accept nullable message and cause 
Existing call sites can pass nullable causes from Throwable.getCause()
- Remove JSR-305 semantics from `@LateInit`
   JSpecify does not support the same type-qualifier-nickname pattern,
so `@LateInit` is now documentation plus a NullAway
constructor-initialization exemption

Out of scope:
- NullAway checking of org.pkl.core.ast and org.pkl.core.stdlib
- IntelliJ warnings related to `@LateInit` fields
- Removing the JSR-305 dependency, since concurrency annotations are
still in use
This commit is contained in:
odenix
2026-05-21 22:57:20 +02:00
committed by GitHub
parent 63ef60f3c4
commit 3dc93cbd4a
261 changed files with 709 additions and 723 deletions
+2 -2
View File
@@ -136,6 +136,6 @@ fun OutputStream.write(str: String) = write(str.toByteArray(Charsets.UTF_8))
fun OutputStream.writeLine(str: String) = write((str + "\n").toByteArray(Charsets.UTF_8))
operator fun <A, B> org.pkl.core.util.Pair<A, B>.component1(): A = first
operator fun <A : Any, B : Any> org.pkl.core.util.Pair<A, B>.component1(): A = first
operator fun <A, B> org.pkl.core.util.Pair<A, B>.component2(): B = second
operator fun <A : Any, B : Any> org.pkl.core.util.Pair<A, B>.component2(): B = second