Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDEA doesnt want to use NotNull from javax, but instead use org.jetbrains

I was setuping my project when saw this on @NotNull annotation in my DTOs

Not 'javax.validation.constraints.NotNull' but 'org.jetbrains.annotations.NotNull' would be used for code generation

I have import javax.validation.constraints.NotNull;

But still see this warning.

Why IDEA dont want to use javax NotNull and what should I do to force it?

like image 346
Anton Kolosok Avatar asked Sep 05 '18 07:09

Anton Kolosok


1 Answers

When you compile your project, the IDE adds assertions to all methods and parameters annotated with the @NotNull annotation. The assertions will fail if null is passed in code where @NotNull is expected. You can disable this option and configure the list of annotations in the Settings/Preferences dialog Ctrl+Alt+S. Go to Build, Execution, Deployment | Compiler.

https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html

Maybe this would to the trick.

like image 187
maio290 Avatar answered Sep 30 '22 11:09

maio290