Hello folks,
I’ve seen that jSpecify is becoming a standard in Java to flag nullable vs. non nullable code.
I was wondering if we could get some support of it in Scala code when integrating with Java libraries to detect possible NPE at compile time.
I haven’t thought about it much for now, I’m looking for people’s feedback on this.
I guess this could be enabled with a specific compilation flag to raise warnings/errors. And/or implemented as part of “explicit nulls” feature to infer types as X | Null for nullable code according to jSpecify annotations.
FWIW, Kotlin has implemented some support for it and raise errors by default:
As of version 2.1.0, the Kotlin compiler emits errors by default for problems found using JSpecify nullness. To change those to warnings, pass the [email protected]:warn flag.