ExpressionUtils#getQualifierOrThis -> getEffectiveQualifier, nullable now (cannot construct this expression for outer anonymous class)

Fixes EA-140652 - assert: JavaParserUtil.parseFragment
This commit is contained in:
Tagir Valeev
2019-04-18 13:03:27 +07:00
parent cd1bfec129
commit 9e1982a819
27 changed files with 217 additions and 83 deletions

View File

@@ -1,7 +1,6 @@
// "Replace Stream API chain with loop" "true"
// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
import java.util.Arrays;
import java.util.List;
import java.util.*;
public class Main {
private static void test(List<String> list) {
@@ -15,4 +14,29 @@ public class Main {
public static void main(String[] args) {
test(Arrays.asList("a", "b", "xyz"));
}
void testLocal() {
class X extends ArrayList<String> {
class Y {
void test() {
for (String s : X.this) {
System.out.println(s);
}
}
}
}
}
void testAnonymous() {
new ArrayList<String>() {
class Y {
void test() {
for (Iterator<String> it = stream().iterator(); it.hasNext(); ) {
String s = it.next();
System.out.println(s);
}
}
}
};
}
}