Skip to content

Commit

Permalink
Add ProcessAnnotation later. (#2848)
Browse files Browse the repository at this point in the history
The process for gathering annotations was:
1. Add ProcessAnnotation
2. Check for anything at --processors
3. If there's nothing then check for processors exposed by META-INF

However (3) will never happen because in (1) we always add a processor. Therefore if we move (1) to happen later we have a chance of getting to annotations.

This is necessary because some processors generate source code and Kythe wasn't running those processors resulting in broken code.
  • Loading branch information
johnedmonds authored and schroederc committed Jul 18, 2018
1 parent 21b22fd commit 47d8bbf
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -710,9 +710,10 @@ private AnalysisResults runJavaAnalysisToExtractCompilationDetails(
compiler.getTask(
null, fileManager, diagnosticsCollector, completeOptions, null, sourceFiles);

List<Processor> procs = Lists.<Processor>newArrayList(new ProcessAnnotation(fileManager));
ClassLoader loader = processingClassloader(classpath, processorpath);

List<Processor> procs = Lists.newArrayList();

// Add any processors passed as flags.
for (String processor : processors) {
try {
Expand All @@ -735,6 +736,8 @@ private AnalysisResults runJavaAnalysisToExtractCompilationDetails(
}
}

procs.add(new ProcessAnnotation(fileManager));

JavacTask javacTask = (JavacTask) task;
javacTask.setProcessors(procs);
syms = Symtab.instance(((JavacTaskImpl) javacTask).getContext());
Expand Down

0 comments on commit 47d8bbf

Please sign in to comment.