Skip to content
Advertisement

Can’t find @Nullable inside javax.annotation.*

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

Advertisement

Answer

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:

JavaScript

and for Gradle:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement