mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
1. Add "may change semantics" when side-effect cannot be extracted 2. Use condition reporting (instead of constant value reporting) for non-short-circuiting & and | (fixes IDEA-216245) 3. Use SimplifyBooleanExpressionFix for boolean constant value instead of replace fix. GitOrigin-RevId: f3e63a75bd92a7305e36fce58bf9e34bdbb03c51
23 lines
597 B
Java
23 lines
597 B
Java
// "Simplify 'pureConsumer(...)' to true extracting side effects" "true"
|
|
import org.jetbrains.annotations.Contract;
|
|
|
|
public class Main {
|
|
private static int counter = 0;
|
|
|
|
public static void main(String[] args) {
|
|
while (true) {
|
|
sideEffect();
|
|
if (!(counter < 5)) break;
|
|
System.out.println(counter);
|
|
}
|
|
}
|
|
|
|
@Contract(value = "!null->true;null->false", pure = true)
|
|
private static boolean pureConsumer(Object consumed) {
|
|
return consumed != null;
|
|
}
|
|
|
|
private static int sideEffect() {
|
|
return counter++;
|
|
}
|
|
} |