import org.jetbrains.annotations.*; import java.util.List; import java.util.Collections; class Test { static final Object RES = null; final Object xyz = null; static final Integer TEST = new Integer(0); void test() { doSmth(RES); doSmth(xyz); System.out.println(process(xyz).hashCode()); Integer x = TEST; System.out.println(TEST); System.out.println(x); System.out.println((String)null); boolean[] f = new boolean[1]; f[0] = true; Object smth = getSmth(); Object[] smths = smth == null ? null : new Object[] {smth}; List list = smth == null ? null : Collections.singletonList(smth); } void parens() { Object x = null; doNotNull(x); x = null; doNotNull((x)); } @NotNull Object testReturn(Object x1, Object x2) { if(x1 == null) return x1; if(x2 == null) return (x2); return new Object(); } @Nullable native Object getSmth(); @Contract("null -> null") native Object process(@Nullable Object obj); native void doNotNull(@NotNull Object obj); native void doSmth(@Nullable Object obj); void bar(Void p) { System.out.println(p); } }