Which @NotNull Java annotation should I use?

前端 未结 22 3387
梦如初夏
梦如初夏 2020-11-22 02:44

I\'m looking to make my code more readable as well as use tooling like IDE code inspection and/or static code analysis (FindBugs and Sonar) to avoid NullPointerExceptions.

22条回答
  •  面向向阳花
    2020-11-22 03:18

    Doesn't sun have their own now? What's this:
    http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules-com.sun/istack/com.sun.istack.internal.htm

    This seems to be packaged with all the versions of Java I've used within the last few years.

    Edit: As mentioned in the comments below, you probably don't want to use these. In that case, my vote is for the IntelliJ jetbrains annotations!

提交回复
热议问题