Examples of LazyPackage


Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

       
        if (alreadyExists[0]) {
            return decl;
        }

        LazyPackage pkg = findOrCreatePackage(module, pkgName);

        // find/make its Unit
        Unit unit = getCompiledUnit(pkg, classMirror);

        // set all the containers
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

    // Packages
   
    public LazyPackage findExistingPackage(Module module, String pkgName) {
        synchronized(getLock()){
            String quotedPkgName = Util.quoteJavaKeywords(pkgName);
            LazyPackage pkg = findCachedPackage(module, quotedPkgName);
            if(pkg != null)
                return pkg;
            // special case for the jdk module
            String moduleName = module.getNameAsString();
            if(AbstractModelLoader.isJDKModule(moduleName)){
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

            return null;
        }
    }
   
    private LazyPackage findCachedPackage(Module module, String quotedPkgName) {
        LazyPackage pkg = packagesByName.get(cacheKeyByModule(module, quotedPkgName));
        if(pkg != null){
            // only return it if it matches the module we're looking for, because if it doesn't we have an issue already logged
            // for a direct dependency on same module different versions logged, so no need to confuse this further
            if(module != null && pkg.getModule() != null && !module.equals(pkg.getModule()))
                return null;
            return pkg;
        }
        return null;
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

    }

    public LazyPackage findOrCreatePackage(Module module, final String pkgName)  {
        synchronized(getLock()){
            String quotedPkgName = Util.quoteJavaKeywords(pkgName);
            LazyPackage pkg = findCachedPackage(module, quotedPkgName);
            if(pkg != null)
                return pkg;
            // try to find it from the module, perhaps it already got created and we didn't catch it
            if(module instanceof LazyModule){
                pkg = (LazyPackage) ((LazyModule) module).findPackageNoLazyLoading(pkgName);
            }else if(module != null){
                pkg = (LazyPackage) module.getDirectPackage(pkgName);
            }
            boolean isNew = pkg == null;
            if(pkg == null){
                pkg = new LazyPackage(this);
                // FIXME: some refactoring needed
                pkg.setName(Arrays.asList(pkgName.split("\\.")));
            }
            packagesByName.put(cacheKeyByModule(module, quotedPkgName), pkg);

            // only bind it if we already have a module
            if(isNew && module != null){
                pkg.setModule(module);
                if(module instanceof LazyModule)
                    ((LazyModule) module).addPackage(pkg);
                else
                    module.getPackages().add(pkg);
            }
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

    /**
     * See explanation in cacheModulelessPackages() below. This is called by LanguageCompiler during loadCompiledModules().
     */
    public LazyPackage findOrCreateModulelessPackage(String pkgName)  {
        synchronized(getLock()){
            LazyPackage pkg = modulelessPackages.get(pkgName);
            if(pkg != null)
                return pkg;
            pkg = new LazyPackage(this);
            // FIXME: some refactoring needed
            pkg.setName(pkgName == null ? Collections.<String>emptyList() : Arrays.asList(pkgName.split("\\.")));
            modulelessPackages.put(pkgName, pkg);
            return pkg;
        }
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

    public void fixDefaultPackage()  {
        synchronized(getLock()){
            Module defaultModule = modules.getDefaultModule();
            Package defaultPackage = defaultModule.getDirectPackage("");
            if(defaultPackage instanceof LazyPackage == false){
                LazyPackage newPkg = findOrCreateModulelessPackage("");
                List<Package> defaultModulePackages = defaultModule.getPackages();
                if(defaultModulePackages.size() != 1)
                    throw new RuntimeException("Assertion failed: default module has more than the default package: "+defaultModulePackages.size());
                defaultModulePackages.clear();
                defaultModulePackages.add(newPkg);
                newPkg.setModule(defaultModule);
                defaultPackage.setModule(null);
            }
        }
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

        // never create a lazy package for ceylon.language when we're documenting it
        if((pkgName.equals(AbstractModelLoader.CEYLON_LANGUAGE)
                || pkgName.startsWith(AbstractModelLoader.CEYLON_LANGUAGE+"."))
            && isModuleLoadedFromSource(AbstractModelLoader.CEYLON_LANGUAGE))
            return super.createPackage(pkgName, module);
        final Package pkg = new LazyPackage(getModelLoader());
        List<String> name = pkgName.isEmpty() ? Collections.<String>emptyList() : splitModuleName(pkgName);
        pkg.setName(name);
        if (module != null) {
            module.getPackages().add(pkg);
            pkg.setModule(module);
        }
        return pkg;
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.loader.model.LazyPackage

        return new RuntimeModelLoader(this, modules);
    }

    @Override
    protected Package createPackage(String pkgName, Module module) {
        final Package pkg = new LazyPackage(getModelLoader());
        List<String> name = pkgName.isEmpty() ?
            Collections.<String>emptyList() :
              splitModuleName(pkgName);
        pkg.setName(name);
        if (module != null) {
            module.getPackages().add(pkg);
            pkg.setModule(module);
        }
        return pkg;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.