Why it is complaining declaration has type inferred from a platform call
when the method which is in java is annotated with NotNull annotation.
I would expect this warning in case if the java method is not annotated with NotNull annotation
code in Kotlin
override fun getOverlay() = createDefaultOverlay(context)
and code in java
@NonNull
public static RecyclerView createRecyclerView(@NonNull Context context) {}
@NonNull(when = When.ALWAYS) should tell Kotlin that the Java code is returning a non-null value.
In your case, you were not using @NonNull(when = When.ALWAYS) directly, but instead had some other custom annotation that applied @NonNull(when = When.ALWAYS). Apparently, there is a bug or limitation in the IDE inspections for nullability that do not handle this case. If you can create a reproducible sample project, consider filing a bug report.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With