Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/optionalIsPresent/beforeConsumer.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

12 lines
324 B
Java

// "Replace Optional.isPresent() condition with functional style expression" "GENERIC_ERROR_OR_WARNING"
import java.util.*;
public class Main {
public void testOptional(Optional<String> str) {
if (str == null) str = Optional.empty();
if (str.isPrese<caret>nt()) {
System.out.println(str.get());
}
}
}