Java: better error recovery on annotation parsing (IDEA-209573)

GitOrigin-RevId: a600121ecbd9fa6338237f0d3802486c7f8a5656
This commit is contained in:
Bas Leijdekkers
2024-07-29 20:34:00 +02:00
committed by intellij-monorepo-bot
parent 0274e2096d
commit 1bdb332af2
9 changed files with 71 additions and 69 deletions

View File

@@ -0,0 +1,9 @@
class Foo {
@<error descr="Cannot resolve symbol 'Deprec'">Deprec</error>(<error descr="Cannot resolve symbol 'ated'">ated</error><EOLError descr="',' or ')' expected"></EOLError>
void a() {}
void b() {}
void c() {}
}

View File

@@ -5,7 +5,7 @@
@Ann(<error descr="Cannot find method 'value'">0</error>) class D {
}
@In(""<error descr="Annotation attribute must be of the form 'name=value'">,</error> create = "")
@In(<error descr="Annotation attribute of the form 'name=value' expected">""</error>, create = "")
class ZZZ {
}
@interface In {

View File

@@ -12,8 +12,6 @@ PsiJavaFile:FirstNameMissed.java
PsiReferenceParameterList
<empty list>
PsiIdentifier:value1('value1')
PsiErrorElement:Annotation attribute must be of the form 'name=value'
<empty list>
PsiJavaToken:COMMA(',')
PsiWhiteSpace(' ')
PsiNameValuePair

View File

@@ -12,8 +12,6 @@ test.java.file
REFERENCE_PARAMETER_LIST
<empty list>
IDENTIFIER
ERROR_ELEMENT
<empty list>
COMMA
WHITE_SPACE
NAME_VALUE_PAIR

View File

@@ -38,6 +38,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testReceiverParameters() { doTest(); }
public void testAnnotationOverIncompleteCode() { doTest(); }
public void testDeclarations() { doTest(); }
public void testErrorRecovery() { doTest(); }
private void doTest() { doTest(getTestName(true) + ".java"); }
private void doTest(String name) { doTest(BASE_PATH + "/" + name, false, false); }