Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unwrapIfStatement/beforeIfLastDisjunct.java
Tagir Valeev 6ffb7e417e [java-dfa] Extract "Constant conditions" into separate "Constant values" inspection (IDEA-58235)
GitOrigin-RevId: 95a81fcd1546afec31afc2a044a9ba5fa1337411
2022-09-08 21:30:59 +00:00

45 lines
1.3 KiB
Java

// "Fix all 'Constant values' problems in file" "true"
import java.util.ArrayList;
import java.util.List;
class Mutant {
List<String> types = new ArrayList<>();
void consider(String type, boolean unmodifiable) {
if (unmodifiable || !types.<caret>add(type)) {
if(Math.random() > 0.5) {
System.out.println("1");
}
} else {
System.out.println("2");
}
if (unmodifiable || !types.add(type)) {
if(Math.random() > 0.5) {
System.out.println("1");
}
}
if (unmodifiable || !types.add(type))
if(Math.random() > 0.5) {
System.out.println("1");
}
if (unmodifiable || !types.add(type))
System.out.println("1");
else
System.out.println("2");
// Cannot extract side effect in the middle
if (unmodifiable || !types.add(type) || Math.random() > 0.5)
System.out.println("1");
else
System.out.println("2");
if (!types.add(type) || unmodifiable)
System.out.println("1");
else
System.out.println("2");
System.out.println("types = " + types);
}
public static void main(String[] args) {
new Mutant().consider("A", false);
}
}