Add @Nullable to Java returns from Kotlin call sites
ProprietaryAdds the JSpecify @Nullable annotation to the return type of Java methods based on how those methods are used in Kotlin code. A Java method returning a reference type appears to Kotlin as a platform type (String!) of unknown nullability; Kotlin call sites that treat the result as possibly null reveal the intended contract. This recipe scans Kotlin sources for such usage — a safe call (call()?.x), an elvis operand (call() ?: fallback), a not-null assertion (call()!!), or a comparison to null — and writes @Nullable onto the matching Java method declaration. Only Java sources are modified; Kotlin sources are read for evidence and left unchanged. Conservative by design: it skips primitive and void returns, methods that already carry a nullability annotation, and @Override methods.
io. moderne. nullability. AddNullableFromKotlinCallSitesmod run . --recipe= io. moderne. nullability. AddNullableFromKotlinCallSitesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.