Skip to content

Invalid Nullness information for Kotlin properties #35419

@bclozel

Description

@bclozel

It seems that Nullness properly gets the nullness information for Kotlin function return types, but not for members accessors in Kotlin data classes.

See the following failing test:

import org.assertj.core.api.Assertions
import org.junit.jupiter.api.Test
import kotlin.reflect.jvm.javaMethod


class NullnessKotlinTests {

	@Test
	fun nullableDataClassMethod() {
		val method = NullableName::class.java.getDeclaredMethod("getName")
		val nullness = Nullness.forMethodReturnType(method)
		Assertions.assertThat(nullness).isEqualTo(Nullness.NULLABLE)
	}

	data class NullableName(val name: String?)
  
}

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)theme: kotlinAn issue related to Kotlin supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions