mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
IDEA-128242 Static code analysis reports "always true" for conditions that are always false
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
class Main {
|
||||
|
||||
public static String getSameObject() {
|
||||
return ""; // same object for any call
|
||||
}
|
||||
|
||||
public static Main getNewObject() {
|
||||
return new Main(); // different objects for different subsequent calls
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Main m = new Main();
|
||||
|
||||
if (m.getSameObject() == m.getSameObject()) {
|
||||
System.out.println("This will get printed");
|
||||
}
|
||||
|
||||
if (m.getNewObject() == m.getNewObject()) {
|
||||
System.out.println("This will not get printed");
|
||||
}
|
||||
|
||||
if (Main.getNewObject() == Main.getNewObject()) {
|
||||
System.out.println("This will not get printed");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user