Пример #1
0
  @Override
  public void visit(VariableDeclarationExpr n, Object arg) {
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    n.getType().accept(this, arg);
    printer.print(" ");

    for (Iterator<VariableDeclarator> i = n.getVars().iterator(); i.hasNext(); ) {
      VariableDeclarator v = i.next();
      v.accept(this, arg);
      if (i.hasNext()) {
        printer.print(", ");
      }
    }
  }
 @Override
 public Void visit(VariableDeclarationExpr expr, AElement elem) {
   List<AnnotationExpr> annos = expr.getAnnotations();
   AMethod method = (AMethod) elem;
   int i = 0;
   for (VariableDeclarator decl : expr.getVars()) {
     LocalLocation loc = new LocalLocation(decl.getId().getName(), i);
     AField field = method.body.locals.vivify(loc);
     visitType(expr.getType(), field.type);
     if (annos != null) {
       for (AnnotationExpr annoExpr : annos) {
         Annotation anno = extractAnnotation(annoExpr);
         field.tlAnnotationsHere.add(anno);
       }
     }
     ++i;
   }
   return null;
 }