-Xjsr305=strict and Spring @NonNullApi compatibility issue

I’m not sure if this is the right place to report bugs, but here it is. :slight_smile:

There is a Java class contained in a package annotated with @org.springframework.lang.NonNullApi. This class overrides equals() method. If we enable -Xjsr305=strict in Kotlin, suddenly == operator stops working for this class.

Apparently in such case Kotlin infers method with signature equals(o: Any), where == operator requires equals(o: Any?) to be present.

A workaround for this issue is to explicitly use equals method instead of == operator.

edit — issue verified on Kotlin version 1.3.60 and 1.3.61.

Hello. Bugs should be reported to http://kotl.in/issue.
This sounds like https://youtrack.jetbrains.com/issue/KT-27194. If it’s not exactly your case, please file a separate issue with a sample project to reproduce. Thanks!