mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 17:07:05 +07:00
IDEA-CR-13980: comments handling is simplified (they just extracted and placed before the condition)
This commit is contained in:
+5
-3
@@ -5,9 +5,11 @@ import java.util.*;
|
||||
public class Main {
|
||||
public void testOptional(Optional<String> str) {
|
||||
String val;
|
||||
val = str.map( // line comment
|
||||
// another line comment
|
||||
/* block comment *//*block comment*/String::trim).orElse("");
|
||||
// line comment
|
||||
// another line comment
|
||||
//before trim
|
||||
/* block comment *//*block comment*/
|
||||
val = str.map(String::trim).orElse("");
|
||||
System.out.println(val);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ public class Main {
|
||||
}
|
||||
|
||||
public Number testOptionalComments(Optional<MyList> strList) {
|
||||
/* optional is present *//* optional is absent */
|
||||
return strList.map( /*return something */ myList -> myList.size() > /*too big*/ 1 ? myList.get(1) : 1.0).orElse( /* return null*/ null);
|
||||
/* optional is present *//*return something *//*too big*//* optional is absent *//* return null*/
|
||||
return strList.map(myList -> myList.size() > 1 ? myList.get(1) : 1.0).orElse(null);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -8,7 +8,8 @@ public class Main {
|
||||
if (str.isPrese<caret>nt()) {
|
||||
val = // line comment
|
||||
// another line comment
|
||||
str.get().trim() /* block comment *//*block comment*/;
|
||||
str.get()//before trim
|
||||
.trim() /* block comment *//*block comment*/;
|
||||
} else {
|
||||
val = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user