Can't get @NotNull/@Nullable to work
I've just had a look at this feature in IntelliJ, and for the life of me I can't get it to work! I've added the annotations JAR file to my project (and it compiles fine), and I have the "@NotNull/@Nullable problems" inspection checked in my error profile, but, I don't get an on-the-fly warning highlight in my source code.
Here is a test class - I would have thought that the "arg.toString()" and "getObject().toString()" lines would be flagged as warnings, but I get nothing.
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
public class t44 {
public t44(@Nullable Object arg) {
String a = arg.toString();
String s = getObject().toString();
}
@Nullable
public Object getObject() {
return(null);
}
public static void main(String[] args) {
new t44(null);
}
}
I'm running IntelliJ 7.0.4.
Any help would be much appreciated.
Thanks.
Christopher Moran
christopher.moran@pobox.com
请先登录再写评论。
Hello Christopher,
The inspection "Constant conditions & exceptions" should do that job. NotNull/Nullable
problems serves for a bit different, as I could understand from its options.
Alexander.