Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using javax.annotation.Nonnull: which java jar dependency to get it from? [duplicate]

In our open source constraint solver (OptaPlanner), I want to use @NonNull to make it more Kotlin friendly and clearer to use from Java, too.

spring-core already uses @NonNull, for example in this code. They effectively state for every method parameter if it's nullable or not, as explained here.

Which maven/gradle dependency should I use to have the class javax.annotation.Nonnull in my classpath? Which one do the spring guys use? For example, I don't see the findbugs JSR-305 jar in their dependency list.

(And can I have it as an optional dependency to avoid bloating my user's classpath?)

like image 461
Geoffrey De Smet Avatar asked Jun 26 '18 11:06

Geoffrey De Smet


1 Answers

I would say that https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 should be your artifact of choice for this, as it's probably the most commonly used and properly maintained.

like image 124
Piotr Wilkin Avatar answered Sep 25 '22 07:09

Piotr Wilkin