SSR: avoid IOE (EA-139295)

This commit is contained in:
Bas Leijdekkers
2019-03-14 17:59:35 +01:00
parent f166d51731
commit ec52eadda4
2 changed files with 10 additions and 1 deletions
@@ -656,7 +656,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
if (typeElement.isInferredType()) {
// replace inferred type with explicit type if possible
final PsiType type = typeElement.getType();
if (type == PsiType.NULL) {
if (type == PsiType.NULL || type instanceof PsiLambdaParameterType) {
return typeElement;
}
final String canonicalText = type.getCanonicalText();
@@ -2356,6 +2356,15 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
" };\n" +
"}";
assertEquals("match statement body correctly", 1, findMatchesCount(source2, pattern7));
String source3 = "class LambdaParameter {\n" +
"\n" +
" void x() {\n" +
" Runnable r = (var a) -> a = \"\";\n" +
" }\n" +
"}";
String pattern8 = "String '_x;";
assertEquals("avoid IncorrectOperationException", 0, findMatchesCount(source3, pattern8));
}
public void testFindDefaultMethods() {