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

IClass org::codehaus::janino::UnitCompiler::importTypeOnDemand ( String  simpleTypeName,
Location  location 
) throws CompileException [inline]

6.5.2.BL1.B1.B5, 6.5.2.BL1.B1.B6 Type-import-on-demand.
6.5.5.1.6 Type-import-on-demand declaration.

Returns:
null if the given simpleTypeName cannot be resolved through any of the import-on-demand directives

Definition at line 6545 of file UnitCompiler.java.

                                                                                                       {

        // Check cache. (A cache for unimportable types is not required, because
        // the class is importable 99.9%.)
        IClass importedClass = (IClass) this.onDemandImportableTypes.get(simpleTypeName);
        if (importedClass != null) return importedClass;

        // Cache miss...
        for (Iterator i = this.typeImportsOnDemand.iterator(); i.hasNext();) {
            String[] ss = (String[]) i.next();
            String[] ss2 = concat(ss, simpleTypeName);
            IClass iClass = this.loadFullyQualifiedClass(ss2);
            if (iClass != null) {
                if (importedClass != null && importedClass != iClass) this.compileError("Ambiguous class name: \"" + importedClass + "\" vs. \"" + iClass + "\"", location);
                importedClass = iClass;
            }
        }
        if (importedClass == null) return null;

        // Put in cache and return.
        this.onDemandImportableTypes.put(simpleTypeName, importedClass);
        return importedClass;
    }


Generated by  Doxygen 1.6.0   Back to index