private void initializeModule() { for (int i = 0; i < this.locations.length; i++) { this.locations[i].setModule(this.module); } } @Override
private void initializeModule() { for (int i = 0; i < this.locations.length; i++) { this.locations[i].setModule(this.module); } } @Override
void addPatchLocation(ClasspathLocation location) { this.locations = Arrays.copyOf(this.locations, this.locations.length+1); this.locations[this.locations.length-1] = location; location.setModule(this.module); }
void addPatchLocation(ClasspathLocation location) { this.locations = Arrays.copyOf(this.locations, this.locations.length+1); this.locations[this.locations.length-1] = location; location.setModule(this.module); }
private String addModuleClassPathInfo(ClasspathLocation cp, IModuleDescription imd) { IModule mod = NameLookup.getModuleDescriptionInfo(imd); String moduleName = null; if (mod != null) { char[] name = mod.name(); if (name != null) { moduleName = new String(name); cp.setModule(mod); addClassPathToModule(moduleName, cp); } } return moduleName; } private void addClassPathToModule(String moduleName, ClasspathLocation cp) {
/** * Given that sourceLocation belongs to the project that patches another module, combine this source location * into the existing {@link IModulePathEntry} for the module to be patched. * @param sourceLocation source location of the patch project * @param patchedModule module defined in the target location * @param moduleEntries map of known module locations */ static void combinePatchIntoModuleEntry(ClasspathLocation sourceLocation, IModule patchedModule, Map<String, IModulePathEntry> moduleEntries) { sourceLocation.setModule(patchedModule); String patchedModuleName = String.valueOf(patchedModule.name()); IModulePathEntry mainEntry = moduleEntries.get(patchedModuleName); ClasspathLocation[] combinedLocations = null; if (mainEntry instanceof ModulePathEntry.Multi) { ((ModulePathEntry.Multi) mainEntry).addPatchLocation(sourceLocation); return; } else if (mainEntry instanceof ClasspathJrt) { combinedLocations = new ClasspathLocation[] { (ClasspathLocation) mainEntry, sourceLocation }; moduleEntries.put(patchedModuleName, new ModulePathEntry.Multi(null, patchedModule, combinedLocations)); return; } else if (mainEntry instanceof ModulePathEntry) { ClasspathLocation[] mainLocs = ((ModulePathEntry) mainEntry).locations; combinedLocations = Arrays.copyOf(mainLocs, mainLocs.length+1); combinedLocations[combinedLocations.length-1] = sourceLocation; } else if (mainEntry instanceof ClasspathLocation) { combinedLocations = new ClasspathLocation[] { (ClasspathLocation) mainEntry, sourceLocation }; } else { throw new IllegalStateException("Cannot patch the module of classpath entry "+mainEntry); //$NON-NLS-1$ } moduleEntries.put(patchedModuleName, new ModulePathEntry(null, patchedModule, combinedLocations)); }
private String addModuleClassPathInfo(ClasspathLocation cp, IModuleDescription imd) { IModule mod = NameLookup.getModuleDescriptionInfo(imd); String moduleName = null; if (mod != null) { char[] name = mod.name(); if (name != null) { moduleName = new String(name); cp.setModule(mod); addClassPathToModule(moduleName, cp); } } return moduleName; } private void addClassPathToModule(String moduleName, ClasspathLocation cp) {
/** * Given that sourceLocation belongs to the project that patches another module, combine this source location * into the existing {@link IModulePathEntry} for the module to be patched. * @param sourceLocation source location of the patch project * @param patchedModule module defined in the target location * @param moduleEntries map of known module locations */ static void combinePatchIntoModuleEntry(ClasspathLocation sourceLocation, IModule patchedModule, Map<String, IModulePathEntry> moduleEntries) { sourceLocation.setModule(patchedModule); String patchedModuleName = String.valueOf(patchedModule.name()); IModulePathEntry mainEntry = moduleEntries.get(patchedModuleName); ClasspathLocation[] combinedLocations = null; if (mainEntry instanceof ModulePathEntry.Multi) { ((ModulePathEntry.Multi) mainEntry).addPatchLocation(sourceLocation); return; } else if (mainEntry instanceof ClasspathJrt) { combinedLocations = new ClasspathLocation[] { (ClasspathLocation) mainEntry, sourceLocation }; moduleEntries.put(patchedModuleName, new ModulePathEntry.Multi(null, patchedModule, combinedLocations)); return; } else if (mainEntry instanceof ModulePathEntry) { ClasspathLocation[] mainLocs = ((ModulePathEntry) mainEntry).locations; combinedLocations = Arrays.copyOf(mainLocs, mainLocs.length+1); combinedLocations[combinedLocations.length-1] = sourceLocation; } else if (mainEntry instanceof ClasspathLocation) { combinedLocations = new ClasspathLocation[] { (ClasspathLocation) mainEntry, sourceLocation }; } else { throw new IllegalStateException("Cannot patch the module of classpath entry "+mainEntry); //$NON-NLS-1$ } moduleEntries.put(patchedModuleName, new ModulePathEntry(null, patchedModule, combinedLocations)); }
private void initModule(ClasspathLocation location) { IModule mod = null; if (location instanceof ClasspathJar) { mod = ((ClasspathJar) location).initializeModule(); } else if (location instanceof ClasspathDirectory){ mod = ((ClasspathDirectory) location).initializeModule(); } if (mod != null) { this.module = mod; this.isAutomaticModule = false; } else { this.module = getAutomaticModule(location); this.isAutomaticModule = true; } location.setModule(this.module); }
private void initModule(ClasspathLocation location) { IModule mod = null; if (location instanceof ClasspathJar) { mod = ((ClasspathJar) location).initializeModule(); } else if (location instanceof ClasspathDirectory){ mod = ((ClasspathDirectory) location).initializeModule(); } if (mod != null) { this.module = mod; this.isAutomaticModule = false; } else { this.module = getAutomaticModule(location); this.isAutomaticModule = true; } location.setModule(this.module); }