Example #1
0
 // prints the brackets of a nested array in reverse order
 // tree is either JCArrayTypeTree or JCAnnotatedTypeTree
 private void printBrackets(JCTree tree) throws IOException {
   JCTree elem = tree;
   while (true) {
     if (elem.hasTag(ANNOTATED_TYPE)) {
       JCAnnotatedType atype = (JCAnnotatedType) elem;
       elem = atype.underlyingType;
       if (elem.hasTag(TYPEARRAY)) {
         print(' ');
         printTypeAnnotations(atype.annotations);
       }
     }
     if (elem.hasTag(TYPEARRAY)) {
       print("[]");
       elem = ((JCArrayTypeTree) elem).elemtype;
     } else {
       break;
     }
   }
 }
Example #2
0
 /**
  * Visitor method: print expression tree.
  *
  * @param prec The current precedence level.
  */
 public void printExpr(JCTree tree, int prec) throws IOException {
   int prevPrec = this.prec;
   try {
     this.prec = prec;
     if (tree == null) print("/*missing*/");
     else {
       tree.accept(this);
     }
   } catch (UncheckedIOException ex) {
     IOException e = new IOException(ex.getMessage());
     e.initCause(ex);
     throw e;
   } finally {
     this.prec = prevPrec;
   }
 }
Example #3
0
 public void scan(JCTree tree) {
   if (tree != null && !result) tree.accept(this);
 }
Example #4
0
 /** Is the given tree an enumerator definition? */
 boolean isEnumerator(JCTree t) {
   return t.hasTag(VARDEF) && (((JCVariableDecl) t).mods.flags & ENUM) != 0;
 }