mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +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
+9
-5
@@ -5,23 +5,27 @@ import java.util.*;
|
||||
class Test {
|
||||
|
||||
private String returnStatement(String in) {
|
||||
return Optional.ofNullable<caret>(in).orElse("foo");
|
||||
return (Optional.ofNullable<caret>(in).orElse("foo"));
|
||||
}
|
||||
|
||||
private void assignment(String in) {
|
||||
String out = null;
|
||||
out = Optional.ofNullable(in).orElse("foo");
|
||||
out = (Optional.ofNullable((in)).orElse("foo"));
|
||||
}
|
||||
|
||||
private void declaration(String in) {
|
||||
String out = Optional.ofNullable(in).orElse("foo");
|
||||
String out = (Optional.ofNullable(in).orElse("foo"));
|
||||
}
|
||||
|
||||
private void statement(String in) {
|
||||
Optional.ofNullable(in).ifPresent(v -> System.out.println(v));
|
||||
(Optional.ofNullable(in).ifPresent(v -> System.out.println(v)));
|
||||
}
|
||||
|
||||
private void statementWithResult(String in) {
|
||||
Optional.of(in).orElse("foo");
|
||||
(Optional.of(in).orElse("foo"));
|
||||
}
|
||||
|
||||
private String partialChain(Optional<String> optional) {
|
||||
return optional.orElse("foo");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user