public static long flags(JCTree tree) {
        switch (tree.getTag()) {
        case JCTree.VARDEF:
            return ((JCVariableDecl) tree).mods.flags;
        case JCTree.METHODDEF:
            return ((JCMethodDecl) tree).mods.flags;
        case JCTree.CLASSDEF:
            return ((JCClassDecl) tree).mods.flags;
        case JCTree.BLOCK:
            return ((JCBlock) tree).flags;
        default:
            return 0;
        }
    }