I've been using Android Studio (that is based on IntelliJ IDEA), and fine with using annotations such as @NonNull.
In addition to Android Studio, I installed IntelliJ IDEA. I found that annotations such as @NonNull are not working. When I build the project, I got the error message:
java: cannot find symbol
symbol: class NonNull
location: class Main
Could you show me how to enable the standard annotations in IntellJ IDEA?
[Edit 1]:
In IntelliJ IDEA: Settings -> Build, Execution, Deployment -> Compiler -> Configure annotations -> org.jetbrains.annotations.NotNull already checked.
[Edit 2]:
In Eclipse: I have no problems using the @NonNull annotation. I ran into the same problem of unresolved annotation symbol in Eclipse at the beginning, however, the quick fix tips popped up on Eclipse (when I pointed the cursor to the unresolved symbol) helped me fix the problem.
By clicking the quick fixes:
- Eclipse added "org.eclipse.jdt.annotation_2_2.600.v2020408-1511.jar" under Referenced Libraries.
- Also, Eclipse added "requires org.eclipse.jdt.annotation;" in module-info.java.
At the time of writing, I haven't been able to get @NonNull working in IntelliJ.