Refine Nullness for Kotlin functions returning Unit

Should have unspecified nullness like for Java void/Void.

Closes gh-35420
This commit is contained in:
Sébastien Deleuze
2025-09-05 11:16:27 +02:00
parent e5b58effa3
commit d2bdf11b39
4 changed files with 24 additions and 3 deletions
@@ -377,6 +377,13 @@ public class NullnessTests {
Assertions.assertThat(nullness).isEqualTo(Nullness.NULLABLE);
}
@Test
void voidClassMethod() throws NoSuchMethodException {
var method = JSpecifyProcessor.class.getMethod("voidClassProcess");
var nullness = Nullness.forMethodReturnType(method);
Assertions.assertThat(nullness).isEqualTo(Nullness.UNSPECIFIED);
}
// Primitive types
@Test