Hi! Spring has a WebClient interface, written in J...
# announcements
m
Hi! Spring has a WebClient interface, written in Java That interface has the following method:
Copy code
contentType(MediaType contentType)
In my Kotlin code I call that method, passing a null Intellij IDEA Ultimate 2020.2 highlights it in red, saying: Null cannot be a value of a non-null type MediaType But there are no special annotations on the interface method Why does this happen, and how do I handle it? (I actually pass a nullable value, and the DefaultWebClient implementation calls a method annotated with @Nullable, so it can work with nulls)
t
more suited in #spring but either way spring has a way of marking entire packages to only accept non null parameters. I think it is
package-info
, it should be part of webflux library
m
is this integration with Idea, or with the compiler?
anyway, cool! thanks 🙂
t
I think it is only ide, but I don’t know if it is also somehow integrated in build tools like gradle or other plugins. but it is not a compiler plugin (pretty sure of this)
a
The kotlin compiler picks up JSR-305 annotations at least. Apparently https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/lang/NonNullApi.html applies it to all java methods