mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 14:40:04 +07:00
OptionalToIfInspection: tests for parenthesized expression and partial chains (IDEA-CR-52832)
GitOrigin-RevId: cbfa6550167e9dd9e157ab860a6ead486938f2cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
93daca06dd
commit
4f473648ee
+8
-3
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user