/** AnnotationsOpt = { '@' Annotation } * * @param kind Whether to parse an ANNOTATION or TYPE_ANNOTATION */ List<JCAnnotation> annotationsOpt(Tag kind) { if (token.kind != MONKEYS_AT) return List.nil(); // optimization ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>(); int prevmode = mode; while (token.kind == MONKEYS_AT) { int pos = token.pos; nextToken(); buf.append(annotation(pos, kind)); } lastmode = mode; mode = prevmode; List<JCAnnotation> annotations = buf.toList(); return annotations; }
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(); } }
/** AnnotationsOpt = { '@' Annotation } * * @param kind Whether to parse an ANNOTATION or TYPE_ANNOTATION */ List<JCAnnotation> annotationsOpt(Tag kind) { if (token.kind != MONKEYS_AT) return List.nil(); // optimization ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>(); int prevmode = mode; while (token.kind == MONKEYS_AT) { int pos = token.pos; nextToken(); buf.append(annotation(pos, kind)); } lastmode = mode; mode = prevmode; List<JCAnnotation> annotations = buf.toList(); return annotations; }
checkAnnotations(); if (token.kind != INTERFACE) { JCAnnotation ann = annotation(lastPos, Tag.ANNOTATION);
checkAnnotations(); if (token.kind != INTERFACE) { JCAnnotation ann = annotation(lastPos, Tag.ANNOTATION);