src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
equal
deleted
inserted
replaced
51 |
51 |
52 import com.sun.source.util.TaskEvent; |
52 import com.sun.source.util.TaskEvent; |
53 import com.sun.tools.javac.api.MultiTaskListener; |
53 import com.sun.tools.javac.api.MultiTaskListener; |
54 import com.sun.tools.javac.code.*; |
54 import com.sun.tools.javac.code.*; |
55 import com.sun.tools.javac.code.Scope.WriteableScope; |
55 import com.sun.tools.javac.code.Scope.WriteableScope; |
|
56 import com.sun.tools.javac.code.Source.Feature; |
56 import com.sun.tools.javac.code.Symbol.*; |
57 import com.sun.tools.javac.code.Symbol.*; |
57 import com.sun.tools.javac.code.Type.ClassType; |
58 import com.sun.tools.javac.code.Type.ClassType; |
58 import com.sun.tools.javac.code.Types; |
59 import com.sun.tools.javac.code.Types; |
59 import com.sun.tools.javac.comp.AttrContext; |
60 import com.sun.tools.javac.comp.AttrContext; |
60 import com.sun.tools.javac.comp.Check; |
61 import com.sun.tools.javac.comp.Check; |
114 private final boolean verbose; |
115 private final boolean verbose; |
115 private final boolean lint; |
116 private final boolean lint; |
116 private final boolean fatalErrors; |
117 private final boolean fatalErrors; |
117 private final boolean werror; |
118 private final boolean werror; |
118 private final boolean showResolveErrors; |
119 private final boolean showResolveErrors; |
119 private final boolean allowModules; |
|
120 |
120 |
121 private final JavacFiler filer; |
121 private final JavacFiler filer; |
122 private final JavacMessager messager; |
122 private final JavacMessager messager; |
123 private final JavacElements elementUtils; |
123 private final JavacElements elementUtils; |
124 private final JavacTypes typeUtils; |
124 private final JavacTypes typeUtils; |
231 names = Names.instance(context); |
231 names = Names.instance(context); |
232 enter = Enter.instance(context); |
232 enter = Enter.instance(context); |
233 initialCompleter = ClassFinder.instance(context).getCompleter(); |
233 initialCompleter = ClassFinder.instance(context).getCompleter(); |
234 chk = Check.instance(context); |
234 chk = Check.instance(context); |
235 initProcessorLoader(); |
235 initProcessorLoader(); |
236 |
|
237 allowModules = source.allowModules(); |
|
238 } |
236 } |
239 |
237 |
240 public void setProcessors(Iterable<? extends Processor> processors) { |
238 public void setProcessors(Iterable<? extends Processor> processors) { |
241 Assert.checkNull(discoveredProcs); |
239 Assert.checkNull(discoveredProcs); |
242 initProcessorIterator(processors); |
240 initProcessorIterator(processors); |
768 onProcInterator = true; |
766 onProcInterator = true; |
769 } |
767 } |
770 |
768 |
771 if (psi.processorIterator.hasNext()) { |
769 if (psi.processorIterator.hasNext()) { |
772 ProcessorState ps = new ProcessorState(psi.processorIterator.next(), |
770 ProcessorState ps = new ProcessorState(psi.processorIterator.next(), |
773 log, source, allowModules, |
771 log, source, Feature.MODULES.allowedInSource(source), |
774 JavacProcessingEnvironment.this); |
772 JavacProcessingEnvironment.this); |
775 psi.procStateList.add(ps); |
773 psi.procStateList.add(ps); |
776 return ps; |
774 return ps; |
777 } else |
775 } else |
778 throw new NoSuchElementException(); |
776 throw new NoSuchElementException(); |
835 List<ModuleSymbol> moduleInfoFiles) { |
833 List<ModuleSymbol> moduleInfoFiles) { |
836 Map<String, TypeElement> unmatchedAnnotations = new HashMap<>(annotationsPresent.size()); |
834 Map<String, TypeElement> unmatchedAnnotations = new HashMap<>(annotationsPresent.size()); |
837 |
835 |
838 for(TypeElement a : annotationsPresent) { |
836 for(TypeElement a : annotationsPresent) { |
839 ModuleElement mod = elementUtils.getModuleOf(a); |
837 ModuleElement mod = elementUtils.getModuleOf(a); |
840 String moduleSpec = allowModules && mod != null ? mod.getQualifiedName() + "/" : ""; |
838 String moduleSpec = Feature.MODULES.allowedInSource(source) && mod != null ? mod.getQualifiedName() + "/" : ""; |
841 unmatchedAnnotations.put(moduleSpec + a.getQualifiedName().toString(), |
839 unmatchedAnnotations.put(moduleSpec + a.getQualifiedName().toString(), |
842 a); |
840 a); |
843 } |
841 } |
844 |
842 |
845 // Give "*" processors a chance to match |
843 // Give "*" processors a chance to match |