OptionalToIfInspection: tests for parenthesized expression and partial chains (IDEA-CR-52832)

GitOrigin-RevId: cbfa6550167e9dd9e157ab860a6ead486938f2cd
This commit is contained in:
Artemiy Sartakov
2019-09-25 08:31:20 +00:00
committed by intellij-monorepo-bot
parent 93daca06dd
commit 4f473648ee
2 changed files with 17 additions and 8 deletions
@@ -5,14 +5,15 @@ import java.util.*;
class Test {
private String returnStatement(String in) {
if (in != null) return in;
return "foo";
if (in != null) return (in);
return ("foo");
}
private void assignment(String in) {
String out = null;
out = "foo";
if (in != null) out = in;
String value = (in);
if (value != null) out = value;
}
private void declaration(String in) {
@@ -27,4 +28,8 @@ class Test {
private void statementWithResult(String in) {
if (in == null) throw new NullPointerException();
}
private String partialChain(Optional<String> optional) {
return optional.orElse("foo");
}
}