Hey :) I hope this is the right place to ask.
I am currently writing a Java class that contains a method that looks something like this
Copy code
void addItem(@NonNull String item){
if (item != null) {
/*additem */
} else {
/* do some error logging */
}
}
Now i wanted to test this method for safe null handling using kotlin and had to find out that kotlin is also evaluating
@NonNull
annotations, which does not allow me to pass null values to the method anymore.
I also tried to fool the compiler by casting to a nullable type, but it seems that methods containing
@NonNull
annotations get bytecode enhanced so that they throw IllegalStateExceptions on null values. My question now is: is there a compiler option to turn off the evaluation of jsr305 annotations?