Logo Search packages:      
Sourcecode: janino version File versions  Download package

ClassFile [] org::codehaus::janino::UnitCompiler::compileUnit ( EnumeratorSet  debuggingInformation  )  throws CompileException [inline]

Generates an array of ClassFile objects which represent the classes and interfaces defined in the compilation unit.

Definition at line 196 of file UnitCompiler.java.

Referenced by org::codehaus::janino::Compiler::compile(), and org::codehaus::janino::JavaSourceClassLoader::generateBytecodes().

                              {

        // Compile static import declarations.
        for (Iterator it = this.compilationUnit.importDeclarations.iterator(); it.hasNext();) {
            ImportDeclaration id = (ImportDeclaration) it.next();
            class UCE extends RuntimeException { final CompileException ce; UCE(CompileException ce) { this.ce = ce; } }
            try {
                id.accept(new ImportVisitor() {
                    public void visitSingleTypeImportDeclaration(SingleTypeImportDeclaration stid)          {}
                    public void visitTypeImportOnDemandDeclaration(TypeImportOnDemandDeclaration tiodd)     {}
                    public void visitSingleStaticImportDeclaration(SingleStaticImportDeclaration ssid)      { try { UnitCompiler.this.import2(ssid);  } catch (CompileException e) { throw new UCE(e); } }
                    public void visitStaticImportOnDemandDeclaration(StaticImportOnDemandDeclaration siodd) { try { UnitCompiler.this.import2(siodd); } catch (CompileException e) { throw new UCE(e); } }
                });
            } catch (UCE uce) { throw uce.ce; }
        }

        this.generatedClassFiles  = new ArrayList();
        this.debuggingInformation = debuggingInformation;

        for (Iterator it = this.compilationUnit.packageMemberTypeDeclarations.iterator(); it.hasNext();) {
            UnitCompiler.this.compile((Java.PackageMemberTypeDeclaration) it.next());
        }

        if (this.compileErrorCount > 0) throw new CompileException(this.compileErrorCount + " error(s) while compiling unit \"" + this.compilationUnit.optionalFileName + "\"", null);

        List l = this.generatedClassFiles;
        return (ClassFile[]) l.toArray(new ClassFile[l.size()]);
    }


Generated by  Doxygen 1.6.0   Back to index