Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/optionalIsPresent/afterConsumerInternalVarAndControlFlow.java
Tagir Valeev dddfd5d7b6 LambdaGenerationUtil#canBeUncheckedLambda: supports statements; checks control-flow breaks;
Fix for IDEA-165369 Replace Optional.isPresent() should be disabled if the thenBranch contains non-local control flow
2016-12-14 15:44:59 +07:00

28 lines
725 B
Java

// "Replace Optional.isPresent() condition with functional style expression" "INFORMATION"
import java.util.Optional;
public class Test {
public static void main(String[] args) {
for(String arg : args) {
Optional<String> opt = Optional.of("xyz");
opt.ifPresent(s -> {
System.out.println(s);
System.out.println(s);
Runnable r = () -> {
return;
};
for (int i = 0; i < 10; i++) {
if (i == 3) continue;
System.out.println(arg);
if (i == 5)
break;
}
System.out.println(s);
throw new RuntimeException();
});
}
}
}