diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java index 0f8932dd6ecf..7df042704c05 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java @@ -665,10 +665,6 @@ class StateMerger { @Override void removeFromState(@NotNull DfaMemoryStateImpl state) { - if(!myPositive && state.isNotNull(myVar) && state.isNull(myArg)) { - // merging "x == null" and "x != null" should be possible with marking "x" as nullable - state.forceVariableFact(myVar, CAN_BE_NULL, true); - } state.removeEquivalenceRelations(myVar); } } diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/NullabilityBasics.java b/java/java-tests/testData/inspection/dataFlow/fixture/NullabilityBasics.java deleted file mode 100644 index 25dbaf2f37c1..000000000000 --- a/java/java-tests/testData/inspection/dataFlow/fixture/NullabilityBasics.java +++ /dev/null @@ -1,31 +0,0 @@ -import org.jetbrains.annotations.*; - -class NullabilityBasics { - - void test2() { - String x = getNullable(); - if (x == null) { - System.out.println("x is null!"); - } - if (isEmpty(x) && Math.random() > 0.5) { - return; - } - System.out.println(x.trim()); - } - - @Nullable String getNullable() { - return Math.random() > 0.5 ? null : ""; - } - - @Contract(value = "null -> true",pure = true) - static boolean isEmpty(@Nullable String s) { - return s == null || s.isEmpty(); - } - - void test(String x) { - if (x == null) { - System.out.println("x is null!"); - } - System.out.println(x.trim()); - } -} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/OptionalTooComplex.java b/java/java-tests/testData/inspection/dataFlow/fixture/OptionalTooComplex.java deleted file mode 100644 index 0beb16c50f15..000000000000 --- a/java/java-tests/testData/inspection/dataFlow/fixture/OptionalTooComplex.java +++ /dev/null @@ -1,48 +0,0 @@ -import java.util.Optional; - -// IDEA-184723 -class OptionalTooComplex { - // Should not be too complex - public Long fetch() { - final PreparedStatement ps = builder - .setInteger(opt().orElse(null)) - .setInteger(opt().orElse(null)) - .setInteger(opt().orElse(null)) - .setInteger(opt().orElse(null)) - .setInteger(opt().orElse(null)) - .build(); - - ResultSet rs = null; - try { - rs = ps.executeQuery(); - if (rs.next()) { - return rs.getLong(); - } - } catch (final Exception e) { - throw new RuntimeException(e); - } finally { - } - - return 0L; - } - - interface ResultSet { - boolean next() throws Exception; - - long getLong() throws Exception; - } - - interface PreparedStatement { - ResultSet executeQuery() throws Exception; - } - - native Optional opt(); - - interface QueryBuilder { - QueryBuilder setInteger(Integer value); - - PreparedStatement build(); - } - - QueryBuilder builder; -} diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspection8Test.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspection8Test.java index 6777aa2d2c29..94bdd47b19e8 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspection8Test.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspection8Test.java @@ -220,6 +220,4 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase { public void testPrimitiveGetters() { doTest(); } public void testUnknownOnStack() { doTest(); } public void testMapUpdateInlining() { doTestWithCustomAnnotations(); } - - public void testOptionalTooComplex() { doTest(); } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java index bf758fbb0076..72d122a81038 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java @@ -582,6 +582,5 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testPrimitiveNull() { doTest(); } public void testLessThanRelations() { doTest(); } public void testAdvancedArrayAccess() { doTest(); } - public void testNullabilityBasics() { doTest(); } public void testNullableGetterInLoop() { doTest(); } }