Nullable/NotNull

hello there,
how does one enable these annotations in cases like below?

@Nullable
private String bar () {
return null;
}

do we have to have any IntelliJ specific classes in the class path?

i'm using build 3397, project jdk 1.5.03, language level set to 5.0

appreciate your help

best regards,
Parthi

3 comments
Comment actions Permalink

@Nullable/@NotNull annotations are in the "annotations.jar" file, in you $IDEA_HOME/redist folder.

0
Comment actions Permalink

After you have this in your classpath, how do you enable the functionality? I can use the annotations, but there is not effect. I was expecting a error when assigning a null value to a non-null variable.

0
Comment actions Permalink

Paul Mal wrote:

After you have this in your classpath, how do you enable the
functionality? I can use the annotations, but there is not effect. I
was expecting a error when assigning a null value to a non-null
variable.


It should work automatically. You should make sure "Constant conditions
& Exceptions" inspection is enabled in Errors panel of Settings.

0

Please sign in to leave a comment.