public static boolean isConstructor(JCTree tree) {
        if (tree.getTag() == JCTree.METHODDEF) {
            Name name = ((JCMethodDecl) tree).name;
            return name == name.table.init;
        } else {
            return false;
        }
    }