IntelliJ reports "Not annotated method overrides method annotated with @NotNull", but there is no annotation?

Answered

If I implement java.lang.Iterable<T>, IntelliJ will mark the method Interator<T> iterator() as "Not annotated method overrides method annotated with @NotNull". But the @NotNull annotation is not part of the interface, it is inferred by IntelliJ. So my question is, isn't this a bug? Should IntelliJ really treat inferred @NotNull annotations like actual ones?

See also this entry on stackoverflow: https://stackoverflow.com/a/33662173/8707976

0
4 comments

Please disabled "Use external annotations" in the inspection settings, see https://youtrack.jetbrains.com/issue/IDEA-192057#focus=streamItem-27-2870693-0-0

0
Avatar
Permanently deleted user

Sorry, I can't seem to find "Use external annotations" in the inspection settings in IntelliJ 2018.2.4. Was it renamed or replaced by another option?

IntelliJ IDEA 2018.2.4 (Ultimate Edition)
Build #IU-182.4505.22, built on September 18, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1

0

There is Settings(Preferences) | Editor | Inspections | Ignore external @NotNull option. Have you tried it?

1

Please sign in to leave a comment.