Beispiel #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;
     }
   }
 }
Beispiel #2
0
 /** Is the given tree an enumerator definition? */
 boolean isEnumerator(JCTree t) {
   return t.hasTag(VARDEF) && (((JCVariableDecl) t).mods.flags & ENUM) != 0;
 }