mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Parse annotations in new expressions
This commit is contained in:
@@ -696,9 +696,12 @@ public class ExpressionParser {
|
||||
myParser.getReferenceParser().parseReferenceParameterList(builder, false, true);
|
||||
|
||||
PsiBuilder.Marker refOrType;
|
||||
|
||||
PsiBuilder.Marker anno = myParser.getDeclarationParser().parseAnnotations(builder);
|
||||
IElementType tokenType = builder.getTokenType();
|
||||
if (tokenType == JavaTokenType.IDENTIFIER || tokenType == JavaTokenType.AT) {
|
||||
if (tokenType == JavaTokenType.IDENTIFIER) {
|
||||
if (anno != null) {
|
||||
anno.rollbackTo();
|
||||
}
|
||||
refOrType = myParser.getReferenceParser().parseJavaCodeReference(builder, true, true, true, true);
|
||||
if (refOrType == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
|
||||
+1
@@ -104,6 +104,7 @@ class Outer {
|
||||
void arrays(String @TA ... docs) {
|
||||
//todo[r.sh]
|
||||
//@TA String @TA [] @TA [] docs1 = new @TA String @TA [2] @TA [2];
|
||||
//@TA int @TA [] ints = new @TA int @TA [2];
|
||||
}
|
||||
|
||||
@TA Outer() { }
|
||||
|
||||
+2
@@ -61,6 +61,8 @@ class SpecSamples {
|
||||
@Readonly Document [][] docs1 = new @Readonly Document [2][12]; // array of arrays of read-only documents
|
||||
Document @Readonly [][] docs2 = new Document @Readonly [2][12]; // read-only array of arrays of documents
|
||||
Document[] @Readonly [] docs3 = new Document[2] @Readonly [12]; // array of read-only arrays of documents
|
||||
|
||||
@NonNegative int @NonEmpty [] ints = new @NonNegative int @MinSize(2) [2];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+67
@@ -1334,6 +1334,73 @@ PsiJavaFile:TypeAnnotations.java
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiComment(END_OF_LINE_COMMENT)('// array of read-only arrays of documents')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiDeclarationStatement
|
||||
PsiLocalVariable:ints
|
||||
PsiModifierList:@NonNegative
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:NonNegative
|
||||
PsiIdentifier:NonNegative('NonNegative')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:int @NonEmpty []
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:NonEmpty
|
||||
PsiIdentifier:NonEmpty('NonEmpty')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACKET('[')
|
||||
PsiJavaToken:RBRACKET(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:ints('ints')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiNewExpression:new @NonNegative int @MinSize(2) [2]
|
||||
PsiKeyword:new('new')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:NonNegative
|
||||
PsiIdentifier:NonNegative('NonNegative')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:MinSize
|
||||
PsiIdentifier:MinSize('MinSize')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiLiteralExpression:2
|
||||
PsiJavaToken:INTEGER_LITERAL('2')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACKET('[')
|
||||
PsiLiteralExpression:2
|
||||
PsiJavaToken:INTEGER_LITERAL('2')
|
||||
PsiJavaToken:RBRACKET(']')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
|
||||
Reference in New Issue
Block a user