public void scan(List<? extends JCTree> trees) {
        if (trees != null)
        for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
            scan(l.head);
    }


/* ***************************************************************************
 * Visitor methods
 ****************************************************************************/

    public void visitTopLevel(JCCompilationUnit tree) {
        scan(tree.defs);
    }

    public void visitPackageDef(JCPackageDecl tree) {
        scan(tree.annotations);
        scan(tree.pid);
    }

    @Override
    public void visitModuleDef(JCModuleDecl tree) {
        scan(tree.mods);
        scan(tree.qualId);
        scan(tree.directives);
    }

    @Override
    public void visitExports(JCExports tree) {
        scan(tree.qualid);
        scan(tree.moduleNames);
    }

    @Override
    public void visitOpens(JCOpens tree) {
        scan(tree.qualid);
        scan(tree.moduleNames);
    }

    @Override
    public void visitProvides(JCProvides tree) {
        scan(tree.serviceName);
        scan(tree.implNames);
    }

    @Override
    public void visitRequires(JCRequires tree) {
        scan(tree.moduleName);
    }

    @Override
    public void visitUses(JCUses tree) {
        scan(tree.qualid);
    }

    public void visitImport(JCImport tree) {
        scan(tree.qualid);
    }

    public void visitClassDef(JCClassDecl tree) {
        scan(tree.mods);
        scan(tree.typarams);
        scan(tree.extending);
        scan(tree.implementing);
        scan(tree.defs);
    }

    public void visitMethodDef(JCMethodDecl tree) {
        scan(tree.mods);
        scan(tree.restype);
        scan(tree.typarams);
        scan(tree.recvparam);
        scan(tree.params);
        scan(tree.thrown);
        scan(tree.defaultValue);
        scan(tree.body);
    }

    public void visitVarDef(JCVariableDecl tree) {
        scan(tree.mods);
        scan(tree.vartype);
        scan(tree.nameexpr);
        scan(tree.init);
    }

    public void visitSkip(JCSkip tree) {
    }
public void scan ( List < ? extends JCTree > trees ) { if ( trees != null ) for ( List < ? extends JCTree > l = trees ; l . nonEmpty ( ) ; l = l . tail ) scan ( l . head ) ; } public void visitTopLevel ( JCCompilationUnit tree ) { scan ( tree . defs ) ; } public void visitPackageDef ( JCPackageDecl tree ) { scan ( tree . annotations ) ; scan ( tree . pid ) ; } @ Override public void visitModuleDef ( JCModuleDecl tree ) { scan ( tree . mods ) ; scan ( tree . qualId ) ; scan ( tree . directives ) ; } @ Override public void visitExports ( JCExports tree ) { scan ( tree . qualid ) ; scan ( tree . moduleNames ) ; } @ Override public void visitOpens ( JCOpens tree ) { scan ( tree . qualid ) ; scan ( tree . moduleNames ) ; } @ Override public void visitProvides ( JCProvides tree ) { scan ( tree . serviceName ) ; scan ( tree . implNames ) ; } @ Override public void visitRequires ( JCRequires tree ) { scan ( tree . moduleName ) ; } @ Override public void visitUses ( JCUses tree ) { scan ( tree . qualid ) ; } public void visitImport ( JCImport tree ) { scan ( tree . qualid ) ; } public void visitClassDef ( JCClassDecl tree ) { scan ( tree . mods ) ; scan ( tree . typarams ) ; scan ( tree . extending ) ; scan ( tree . implementing ) ; scan ( tree . defs ) ; } public void visitMethodDef ( JCMethodDecl tree ) { scan ( tree . mods ) ; scan ( tree . restype ) ; scan ( tree . typarams ) ; scan ( tree . recvparam ) ; scan ( tree . params ) ; scan ( tree . thrown ) ; scan ( tree . defaultValue ) ; scan ( tree . body ) ; } public void visitVarDef ( JCVariableDecl tree ) { scan ( tree . mods ) ; scan ( tree . vartype ) ; scan ( tree . nameexpr ) ; scan ( tree . init ) ; } public void visitSkip ( JCSkip tree ) { }
Visitor method: scan a list of nodes.