import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; class Scratch { String[] data; @Nullable String value; void test() { if (hasValue() && value.isEmpty()) {} if (!hasValue() && value.isEmpty()) {} } void testAndChainInlining() { if (hasData() && data.length > 0) {} if (data.length > 0 && hasData()) {} } void testOverriddenNullity() { // we inline nullable value, but should not report nullability problem here: it's reported inside the inlined method System.out.println(getValueNotNull().trim()); } private boolean hasValue() { return value != null; } @NotNull private String getValueNotNull() { return value; } private boolean hasData() { return data != null && data.length > 0; } int[] array; private int readValue() { return array[0]; } void testArraySize() { if(readValue() > 0 && array.length > 0) {} } Object element; private String getString() { return ((String)element); } void testGetString() { if(!getString().isEmpty() && element instanceof String) {} } }