Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/ContractPreservesUnknownMethodNullability.java

22 lines
664 B
Java

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;
class TestCase {
private void countWordsWarning() {
// no warnings should be here
String s = normalizeSpace(unknown()).trim();
String s3 = normalizeSpaceInverted(unknown()).trim();
String s4 = normalizeSpace(null).<warning descr="Method invocation 'trim' will produce 'NullPointerException'">trim</warning>();
}
public static native String unknown();
@Contract("null->null")
public static native String normalizeSpace(@Nullable String str);
@Contract("!null->!null; _->null")
public static native String normalizeSpaceInverted(String str);
}