I want use @Nullable
annotation to eliminate NullPointerExceptions
.
I found some tutorials on the net, I noticed that this annotation comes from the package javax.annotation.Nullable
;
but when I import it a compilation error is generated: cannot find symbol
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If anyone has this issue when building a Maven project created in IntelliJ IDEA externally, I used the following dependency instead of the answer:
Using this will allow the project to build on IntelliJ IDEA and by itself using Maven.
You can find it here.
If you are using Gradle, you could include the dependency like this:
In the case of Android projects, you can fix this error by changing the project/module gradle file (build.gradle) as follows:
For more informations, please refer here.
you can add latest version of this by adding following line inside your gradle.build.
I am using Guava which has annotation included:
(Gradle code )
You need to include a jar that this class exists in. You can find it here
If using Maven, you can add the following dependency declaration: