code: public static long flags(JCTree tree) {
          switch (tree.getTag()) {
          case VARDEF:
              return ((JCVariableDecl) tree).mods.flags;
          case METHODDEF:
              return ((JCMethodDecl) tree).mods.flags;
          case CLASSDEF:
              return ((JCClassDecl) tree).mods.flags;
          case BLOCK:
              return ((JCBlock) tree).flags;
          default:
              return 0;
          }
      }
docs: If this tree is a declaration or a block, return its flags field,
  otherwise return 0.