/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (LAX_IDENTIFIER.accepts(token.kind)) { mode = EXPR; JCExpression t1 = term1(); if (t1.hasTag(IDENT) && token.kind == EQ) { int pos = token.pos; accept(EQ); JCExpression v = annotationValue(); return toP(F.at(pos).Assign(t1, v)); } else { return t1; } } return annotationValue(); }
/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (LAX_IDENTIFIER.accepts(token.kind)) { mode = EXPR; JCExpression t1 = term1(); if (t1.hasTag(IDENT) && token.kind == EQ) { int pos = token.pos; accept(EQ); JCExpression v = annotationValue(); return toP(F.at(pos).Assign(t1, v)); } else { return t1; } } return annotationValue(); }
JCExpression annotationValue() { int pos; switch (token.kind) { case MONKEYS_AT: pos = token.pos; nextToken(); return annotation(pos, Tag.ANNOTATION); case LBRACE: pos = token.pos; accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (token.kind == COMMA) { nextToken(); } else if (token.kind != RBRACE) { buf.append(annotationValue()); while (token.kind == COMMA) { nextToken(); if (token.kind == RBRACE) break; buf.append(annotationValue()); } } accept(RBRACE); return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList())); default: mode = EXPR; return term1(); } }
JCExpression annotationValue() { int pos; switch (token.kind) { case MONKEYS_AT: pos = token.pos; nextToken(); return annotation(pos, Tag.ANNOTATION); case LBRACE: pos = token.pos; accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (token.kind == COMMA) { nextToken(); } else if (token.kind != RBRACE) { buf.append(annotationValue()); while (token.kind == COMMA) { nextToken(); if (token.kind == RBRACE) break; buf.append(annotationValue()); } } accept(RBRACE); return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList())); default: mode = EXPR; return term1(); } }
if (token.kind == DEFAULT) { accept(DEFAULT); defaultValue = annotationValue(); } else { defaultValue = null;
if (token.kind == DEFAULT) { accept(DEFAULT); defaultValue = annotationValue(); } else { defaultValue = null;