QD-6555: make derived references reachable for not initializing entry methods IJ-CR-112227

GitOrigin-RevId: cca88dd3552e5ca7a217474d82c17f89c28a7cba
This commit is contained in:
Aleksander Movsesov
2023-08-31 10:16:08 +00:00
committed by intellij-monorepo-bot
parent 6e7efe04da
commit a6eb2f5500
9 changed files with 69 additions and 2 deletions
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
</problems>
@@ -0,0 +1,11 @@
public abstract class A {
@SuppressWarnings("UnusedDeclaration")
public abstract void foo();
@SuppressWarnings("UnusedDeclaration")
public void bar() {
foo();
new B;
}
}
@@ -0,0 +1,4 @@
public class B extends A {
@Override
public void foo() {}
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
</problems>
@@ -0,0 +1,11 @@
public abstract class A {
@SuppressWarnings("UnusedDeclaration")
public abstract void foo();
public void bar() {
foo();
}
public void baz() {
bar();
}
}
@@ -0,0 +1,4 @@
public class B extends A {
@Override
public void foo() {}
}
@@ -0,0 +1,19 @@
public class Main {
public A field;
public static void main(String[] args) {
init();
field.baz();
}
private static void init()
{
if (condition()) {
field = new A;
}
else {
field = new B;
}
}
}