IDEA-CR-13980: comments handling is simplified (they just extracted and placed before the condition)

This commit is contained in:
Tagir Valeev
2016-09-30 16:32:25 +07:00
parent 1a4991abea
commit 355973cb56
4 changed files with 26 additions and 36 deletions
@@ -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);
}
}
@@ -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);
}
}
@@ -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 = "";
}