@Override public IModule getModuleInfo() throws JavaModelException { if (this.info == null) { ModularClassFile classFile = (ModularClassFile) this.parent; this.info = classFile.getBinaryModuleInfo(); } return this.info; } @Override
/** * Creates the single child element for this class file adding the resulting * new handle (of type {@link IBinaryModule}) and info object to the newElements table. * Returns true if successful, or false if an error is encountered parsing the class file. * * @see Openable * @see Signature */ @Override protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException { IBinaryModule moduleInfo = getBinaryModuleInfo(); if (moduleInfo == null) { // The structure of a class file is unknown if a class file format errors occurred //during the creation of the diet class file representative of this ClassFile. info.setChildren(JavaElement.NO_ELEMENTS); return false; } // Create & link a handle: BinaryModule module = new BinaryModule(this, moduleInfo); newElements.put(module, moduleInfo); info.setChildren(new IJavaElement[] {module}); this.binaryModule = module; if (info instanceof ClassFileInfo) { ((ClassFileInfo) info).setModule(module); } ((PackageFragmentRootInfo) getPackageFragmentRoot().getElementInfo()).setModule(module); return true; }
public void locateMatches(MatchLocator locator, ModularClassFile mClassFile) throws CoreException { SearchPattern pattern = locator.pattern; this.modularClassFile = mClassFile; this.binaryModule = this.modularClassFile.getBinaryModuleInfo(); if (this.binaryModule == null) return; // cache all the details this.moduleDesc = mClassFile.getModule(); this.moduleName = this.binaryModule.name(); this.module = locator.lookupEnvironment.getModule(this.moduleName); matchModuleDeclaration(pattern, locator); matchModuleReferences(pattern, locator); matchPackageReferences(pattern, locator); matchTypeReferences(pattern, locator); } private void matchModuleDeclaration(SearchPattern pattern, MatchLocator locator) throws CoreException {
public void locateMatches(MatchLocator locator, ModularClassFile mClassFile) throws CoreException { SearchPattern pattern = locator.pattern; this.modularClassFile = mClassFile; this.binaryModule = this.modularClassFile.getBinaryModuleInfo(); if (this.binaryModule == null) return; // cache all the details this.moduleDesc = mClassFile.getModule(); this.moduleName = this.binaryModule.name(); this.module = locator.lookupEnvironment.getModule(this.moduleName); matchModuleDeclaration(pattern, locator); matchModuleReferences(pattern, locator); matchPackageReferences(pattern, locator); matchTypeReferences(pattern, locator); } private void matchModuleDeclaration(SearchPattern pattern, MatchLocator locator) throws CoreException {
/** * Creates the single child element for this class file adding the resulting * new handle (of type {@link IBinaryModule}) and info object to the newElements table. * Returns true if successful, or false if an error is encountered parsing the class file. * * @see Openable * @see Signature */ @Override protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException { IBinaryModule moduleInfo = getBinaryModuleInfo(); if (moduleInfo == null) { // The structure of a class file is unknown if a class file format errors occurred //during the creation of the diet class file representative of this ClassFile. info.setChildren(JavaElement.NO_ELEMENTS); return false; } // Read the module BinaryModule module = ((ClassFileInfo) info).readBinaryModule(this, (HashMap<?,?>) newElements, moduleInfo); if (module != null) { this.binaryModule = module; info.setChildren(new IJavaElement[] {module}); ((PackageFragmentRootInfo) getPackageFragmentRoot().getElementInfo()).setModule(module); } return true; }