How to use the @Contract annotation

I am trying to learn how to quickly develop launch applications using libraries and annotations. I already tested @NonNull, @Nullable.

While reading javadocs, I noticed that there is an @Contract annotation that uses @Contract ("null-> fail"), which makes a compilation error if null is passed.

This is a really cool feature, but I can't use it because there is no annotation class in the support.annotations package.

How can I get this feature? Or which library to import?

Thanks.

+7
android annotations
source share
1 answer

You need to add jetbrains annotations jar to your classpath. You can find it in maven central or locally, in <IntelliJ IDEA Home>/lib/annotations.jar

enter image description here

+3
source share

All Articles