mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
volatile field's nullity shouldn't be used for dfa (IDEA-64696)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import javax.swing.*;
|
||||
|
||||
class Test {
|
||||
public void setObj(Object obj) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
obj = new Object();
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Object o = obj;
|
||||
if (o != null) {
|
||||
System.out.println("x");
|
||||
}
|
||||
}
|
||||
});
|
||||
final Object u = new Object();
|
||||
if (<warning descr="Condition 'u != null' is always 'true'">u != null</warning>) {
|
||||
System.out.println("y");
|
||||
}
|
||||
obj = null;
|
||||
}
|
||||
|
||||
private volatile Object obj;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
class Test {
|
||||
public void setObj(Object obj) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
obj = new Object();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Object o = obj;
|
||||
if (<warning descr="Condition 'o != null' is always 'true'">o != null</warning>) {
|
||||
System.out.println("x");
|
||||
}
|
||||
}
|
||||
});
|
||||
obj = <warning descr="'null' is assigned to a variable that is annotated with @NotNull">null</warning>;
|
||||
}
|
||||
|
||||
@NotNull private volatile Object obj;
|
||||
}
|
||||
Reference in New Issue
Block a user