@Override public boolean isParsingModuleDeclaration() { // It can be a null in case of a Vanguard parser, which means no module to be dealt with. return (this.parsingJava9Plus && this.compilationUnit != null && this.compilationUnit.isModuleInfo()); } }
@Override public boolean isParsingModuleDeclaration() { // It can be a null in case of a Vanguard parser, which means no module to be dealt with. return (this.parsingJava9Plus && this.compilationUnit != null && this.compilationUnit.isModuleInfo()); } }
private void forEachCompilationUnit(List<CompilationUnitDeclaration> unitList, SpoonProgress.Process process, Consumer<CompilationUnitDeclaration> consumer) { if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().start(process); } int i = 0; for (CompilationUnitDeclaration unit : unitList) { if (unit.isModuleInfo() || !unit.isEmpty()) { final String unitPath = new String(unit.getFileName()); if (canProcessCompilationUnit(unitPath)) { consumer.accept(unit); } if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().step(process, unitPath, ++i, unitList.size()); } } } if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().end(process); } }
@Override public ModuleBinding module() { if (!this.referenceContext.isModuleInfo() && this.referenceContext.types == null && this.referenceContext.currentPackage == null && this.referenceContext.imports == null) { this.environment = this.environment.UnNamedModule.environment; return this.environment.UnNamedModule; } return super.module(); }
private void initModuleInfo(RecoveredElement element) { if (element instanceof RecoveredUnit) { RecoveredUnit unit = (RecoveredUnit) element; if (unit.unitDeclaration.isModuleInfo()) { ASTNode node = null; int i = 0; for (; i <= this.astPtr; i++) { if ((node = this.astStack[i]) instanceof ModuleDeclaration) { unit.add((ModuleDeclaration) node, this.bracketDepth); break; } } } } } protected void consumeAnnotationTypeDeclarationHeader() {
private void initModuleInfo(RecoveredElement element) { if (element instanceof RecoveredUnit) { RecoveredUnit unit = (RecoveredUnit) element; if (unit.unitDeclaration.isModuleInfo()) { ASTNode node = null; int i = 0; for (; i <= this.astPtr; i++) { if ((node = this.astStack[i]) instanceof ModuleDeclaration) { unit.add((ModuleDeclaration) node, this.bracketDepth); break; } } } } } @Override
public void acceptModuleInfo(ICompilationUnit cu, Parser parser) { CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); // Request could also come in when module-info has changed or removed. if (unit.isModuleInfo() && unit.moduleDeclaration != null) { this.module = new BasicModule(unit.moduleDeclaration, null); } } @Override
public void acceptModuleInfo(ICompilationUnit cu, Parser parser) { CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); // Request could also come in when module-info has changed or removed. if (unit.isModuleInfo() && unit.moduleDeclaration != null) { this.module = new BasicModule(unit.moduleDeclaration, null); } } public void setModule(IModule mod) {
private static IModule extractModuleFromSource(File file, Parser parser, Classpath pathEntry) { ICompilationUnit cu = new CompilationUnit(null, file.getAbsolutePath(), null); CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); if (unit.isModuleInfo() && unit.moduleDeclaration != null) { return new BasicModule(unit.moduleDeclaration, pathEntry); } return null; } }
private static IModule extractModuleFromSource(File file, Parser parser, Classpath pathEntry) { ICompilationUnit cu = new CompilationUnit(null, file.getAbsolutePath(), null, pathEntry.getDestinationPath()); CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); if (unit.isModuleInfo() && unit.moduleDeclaration != null) { return new BasicModule(unit.moduleDeclaration, pathEntry); } return null; } }
private IModule extractModuleDesc(String fileName) { IModule mod = null; // this.options may not be completely populated yet, and definitely not // validated. Make sure the source level is set for the parser Map<String,String> opts = new HashMap<String, String>(this.options); opts.put(CompilerOptions.OPTION_Source, this.options.get(CompilerOptions.OPTION_Compliance)); Parser parser = new Parser(new ProblemReporter(getHandlingPolicy(), new CompilerOptions(opts), getProblemFactory()), false); if (fileName.toLowerCase().endsWith(IModule.MODULE_INFO_JAVA)) { ICompilationUnit cu = new CompilationUnit(null, fileName, null); CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); if (unit.isModuleInfo() && unit.moduleDeclaration != null) { mod = new BasicModule(unit.moduleDeclaration, null); } } else if (fileName.toLowerCase().endsWith(IModule.MODULE_INFO_CLASS)) { try { ClassFileReader reader = ClassFileReader.read(fileName); // Check the absolute path? mod = reader.getModuleDeclaration(); } catch (ClassFormatException | IOException e) { e.printStackTrace(); throw new IllegalArgumentException( this.bind("configure.invalidModuleDescriptor", fileName)); //$NON-NLS-1$ } } return mod; }
private IModule extractModuleDesc(String fileName) { IModule mod = null; // this.options may not be completely populated yet, and definitely not // validated. Make sure the source level is set for the parser Map<String,String> opts = new HashMap<String, String>(this.options); opts.put(CompilerOptions.OPTION_Source, this.options.get(CompilerOptions.OPTION_Compliance)); Parser parser = new Parser(new ProblemReporter(getHandlingPolicy(), new CompilerOptions(opts), getProblemFactory()), false); if (fileName.toLowerCase().endsWith(IModule.MODULE_INFO_JAVA)) { ICompilationUnit cu = new CompilationUnit(null, fileName, null); CompilationResult compilationResult = new CompilationResult(cu, 0, 1, 10); CompilationUnitDeclaration unit = parser.parse(cu, compilationResult); if (unit.isModuleInfo() && unit.moduleDeclaration != null) { mod = new BasicModule(unit.moduleDeclaration, null); } } else if (fileName.toLowerCase().endsWith(IModule.MODULE_INFO_CLASS)) { try { ClassFileReader reader = ClassFileReader.read(fileName); // Check the absolute path? mod = reader.getModuleDeclaration(); } catch (ClassFormatException | IOException e) { e.printStackTrace(); throw new IllegalArgumentException( this.bind("configure.invalidModuleDescriptor", fileName)); //$NON-NLS-1$ } } return mod; }
private boolean checkKeyword() { if (this.currentElement instanceof RecoveredUnit) { RecoveredUnit unit = (RecoveredUnit) this.currentElement; if (unit.unitDeclaration.isModuleInfo()) return false; int index = -1; if ((index = this.indexOfAssistIdentifier()) > -1) {
private boolean checkKeyword() { if (this.currentElement instanceof RecoveredUnit) { RecoveredUnit unit = (RecoveredUnit) this.currentElement; if (unit.unitDeclaration.isModuleInfo()) return false; int index = -1; if ((index = this.indexOfAssistIdentifier()) > -1) {
private Binding findSingleImport(char[][] compoundName, int mask, boolean findStaticImports) { if (compoundName.length == 1) { // findType records the reference // the name cannot be a package if (compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4 && !this.referenceContext.isModuleInfo()) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); ReferenceBinding typeBinding = findType(compoundName[0], this.environment.defaultPackage, this.fPackage); if (typeBinding == null) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); return typeBinding; } if (findStaticImports) return findSingleStaticImport(compoundName, mask); return findImport(compoundName, compoundName.length); } private Binding findSingleStaticImport(char[][] compoundName, int mask) {
private Binding findSingleImport(char[][] compoundName, int mask, boolean findStaticImports) { if (compoundName.length == 1) { // findType records the reference // the name cannot be a package if (compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4 && !this.referenceContext.isModuleInfo()) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); ReferenceBinding typeBinding = findType(compoundName[0], this.environment.defaultPackage, this.fPackage); if (typeBinding == null) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); return typeBinding; } if (findStaticImports) return findSingleStaticImport(compoundName, mask); return findImport(compoundName, compoundName.length); } private Binding findSingleStaticImport(char[][] compoundName, int mask) {
CompilationUnitDeclaration parsedUnit = this.parser.dietParse(possibleMatch, unitResult); if (parsedUnit != null) { if (parsedUnit.isModuleInfo()) { if (mustResolve) { this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
CompilationUnitDeclaration parsedUnit = this.parser.dietParse(possibleMatch, unitResult); if (parsedUnit != null) { if (parsedUnit.isModuleInfo()) { if (mustResolve) { this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
if (this.isModuleInfo() && this.moduleDeclaration != null) { this.moduleDeclaration.traverse(visitor, this.scope);
if (this.isModuleInfo() && this.moduleDeclaration != null) { this.moduleDeclaration.traverse(visitor, this.scope);