mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: support outer class fields access with qualified this
more test samples
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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(<warning descr="Method invocation 'Impl2.this.o2.hashCode()' may produce 'java.lang.NullPointerException'">Impl2.this.o2.hashCode()</warning>);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SomeSuper s = Impl1.this;
|
||||
if (s.o2 != null) {
|
||||
System.out.println(s.o2.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user