private void loadModuleFromSource( Package pkg, Modules modules, LinkedList<JCCompilationUnit> moduleTrees, List<JCCompilationUnit> parsedTrees) { // skip it if we already resolved the package if (pkg.getModule() != null) { // make sure the default module is always added to the classpath, it will be the only one to // have a module if (!addedDefaultModuleToClassPath && pkg.getModule().isDefaultModule()) { addedDefaultModuleToClassPath = true; ceylonEnter.addOutputModuleToClassPath(pkg.getModule()); } return; } String pkgName = pkg.getQualifiedNameString(); Module module = null; // do we have a module for this package? // FIXME: is this true? what if we have a module.ceylon at toplevel? if (pkgName.isEmpty()) module = modules.getDefaultModule(); else { for (Module m : modulesLoadedFromSource) { if (JvmBackendUtil.isSubPackage(m.getNameAsString(), pkgName)) { module = m; break; } } if (module == null) { module = loadModuleFromSource(pkgName, moduleTrees, parsedTrees); } else if (!module.isAvailable()) { loadModuleFromSource(pkgName, moduleTrees, parsedTrees); } if (module == null) { // no declaration for it, must be the default module, unless we're bootstrapping the // language module, // because we have some com.redhat.ceylon packages that must go in the language module if (isBootstrap) module = modules.getLanguageModule(); else module = modules.getDefaultModule(); } } // bind module and package together pkg.setModule(module); if (!module.getPackages().contains(pkg)) { module.getPackages().add(pkg); } // automatically add this module's jar to the classpath if it exists ceylonEnter.addOutputModuleToClassPath(module); }
private boolean isNonimportable(Package pkg, String name) { String pname = pkg.getQualifiedNameString(); return pname.equals("java.lang") && ("Object".equals(name) || "Throwable".equals(name) || "Exception".equals(name)) || pname.equals("java.lang.annotation") && "Annotation".equals(name); }