No @NotNull annotations shown in latest Preview version

I have one very simple method:

public void testNull(String s) {
      if (s == null) {


I don't see any @NotNull annotation for it in the gutter, and I think it should be shown as written here:

Am I doing something wrong or is this a bug?

Comment actions Permalink

@NotNull on a parameter means that a method will surely fail if this parameter is null. Your method won't fail, so there's no reason for @NotNull to be there. Besides, only contract annotations are inferred so far from the sources, @NotNull's are only inferred automatically in the library code. You can open, for example, SwingUtilities class and see a lot of them there.

Comment actions Permalink

Hi Peter,

you are basically saing that:
- those annotations are not displayed on-the-fly, but only when the resp. code is a dependency of the project (jar).
- for my example, (if the code was in a jar), a @Nullable annotation would be shown.

Have I got you correctly?



Please sign in to leave a comment.