I'm consuming a library that has properties annota...
# getting-started
b
I'm consuming a library that has properties annotated with @NotNull (jakarta) but not @Nullable; it also provides no package-info.java; is there a way to tell Kotlin that types without @NotNull in a package root should be treated as nullable?
1
v
Did you try to annotate the package in
package-info.java
with
@Nullable
?
b
it's a jar from maven, can I override that locally when pulling that down as a dependency?
v
Don't think so
j
If you are the owner of that Java lib I think you can add annotations for "NotNull" https://reflectoring.io/spring-boot-null-safety-annotations/ Ubleash uses their own in https://github.com/Unleash/unleash-client-java/blob/main/src/main/java/io/getunleash/package-info.java#L1
b
unfortunately I'm not
j
I think I read it all wrong. I would have guessed that the values/values returned by Java code to be nullable if not defined otherwise?
b
at least how I kinda understood it by now: you need to annotate the package for that to work
I think there are annotations on how nullability is decided if an annotation is absent
v
I would have guessed that the values/values returned by Java code to be nullable if not defined otherwise?
Without annotation they are potentially nullable, they are so-called platform types, the ones with
!
suffix in the IDE type display.