diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/OptionalThis.java b/java/java-tests/testData/inspection/dataFlow/fixture/OptionalThis.java index 7e70f258dc44..e76265ab5a8b 100644 --- a/java/java-tests/testData/inspection/dataFlow/fixture/OptionalThis.java +++ b/java/java-tests/testData/inspection/dataFlow/fixture/OptionalThis.java @@ -1,6 +1,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.lang.Override; +import java.lang.Runnable; + class TestInspection { private static class StringWrapper { @@ -45,17 +48,3 @@ class TestInspection { } } -class WithInner { - @Nullable Object o; - - { - new Runnable() { - @Override - public void run() { - if (WithInner.this.o != null) { - System.out.println(WithInner.this.o.toString()); - } - } - }; - } -} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/QualifiedThis.java b/java/java-tests/testData/inspection/dataFlow/fixture/QualifiedThis.java new file mode 100644 index 000000000000..f7f705dd91b1 --- /dev/null +++ b/java/java-tests/testData/inspection/dataFlow/fixture/QualifiedThis.java @@ -0,0 +1,40 @@ +import org.jetbrains.annotations.Nullable; + +class WithInner extends SomeSuper { + @Nullable Object o; + + { + new Runnable() { + @Override + public void run() { + if (WithInner.this.o != null) { + System.out.println(WithInner.this.o.toString()); + } + } + }; + } +} + +class SomeSuper { + @Nullable Object o2; +} + +class Impl1 extends SomeSuper { + class Impl2 extends SomeSuper { + { + new Runnable() { + @Override + public void run() { + if (Impl1.this.o2 != null) { + System.out.println(Impl2.this.o2.hashCode()); + } + } + }; + + SomeSuper s = Impl1.this; + if (s.o2 != null) { + System.out.println(s.o2.toString()); + } + } + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index e22fb0d71d13..efb38217a88b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -107,6 +107,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { public void testAccessorPlusMutator() throws Throwable { doTest(); } public void testClosureVariableField() throws Throwable { doTest(); } public void testOptionalThis() { doTest(); } + public void testQualifiedThis() { doTest(); } public void testAssigningNullableToNotNull() throws Throwable { doTest(); } public void testAssigningUnknownToNullable() throws Throwable { doTest(); }