/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (S.token() == IDENTIFIER) { mode = EXPR; JCExpression t1 = term1(); if (t1.tag == JCTree.IDENT && S.token() == EQ) { int pos = S.pos(); accept(EQ); return toP(F.at(pos).Assign(t1, annotationValue())); } else { return t1; } } return annotationValue(); }
/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (S.token() == IDENTIFIER) { mode = EXPR; JCExpression t1 = term1(); if (t1.getTag() == JCTree.IDENT && S.token() == EQ) { int pos = S.pos(); accept(EQ); return toP(F.at(pos).Assign(t1, annotationValue())); } else { return t1; } } return annotationValue(); }
JCExpression annotationValue() { int pos; switch (S.token()) { case MONKEYS_AT: pos = S.pos(); S.nextToken(); return annotation(pos); case LBRACE: pos = S.pos(); accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (S.token() != RBRACE) { buf.append(annotationValue()); while (S.token() == COMMA) { S.nextToken(); if (S.token() == RPAREN) 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 (S.token()) { case MONKEYS_AT: pos = S.pos(); S.nextToken(); return annotation(pos); case LBRACE: pos = S.pos(); accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (S.token() != RBRACE) { buf.append(annotationValue()); while (S.token() == COMMA) { S.nextToken(); if (S.token() == 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 (S.token() == DEFAULT) { accept(DEFAULT); defaultValue = annotationValue(); } else { defaultValue = null;
if (S.token() == DEFAULT) { accept(DEFAULT); defaultValue = annotationValue(); } else { defaultValue = null;