Changing annotation processing to use single Context for all rounds of annotation processing
Werner Dietl
wdietl at gmail.com
Fri Mar 7 00:10:52 PST 2014
Hi Jan,
thanks for the heads-up!
The Checker Framework compiles with these changes, but there is one
unit test failure:
https://code.google.com/p/checker-framework/source/browse/checkers/tests/framework/UnimportedExtends2.java
now fails with:
[junit] Testcase:
run[framework/UnimportedExtends2](tests.FrameworkTest): Caused an
ERROR
[junit] null
[junit] java.lang.NullPointerException
[junit] at com.sun.tools.javac.main.JavaCompiler.complete(JavaCompiler.java:795)
[junit] at com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1307)
[junit] at com.sun.tools.javac.code.Symbol.complete(Symbol.java:560)
[junit] at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1030)
[junit] at com.sun.tools.javac.code.Type$ClassType.complete(Type.java:913)
[junit] at com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:831)
[junit] at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:223)
[junit] at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
[junit] at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:763)
[junit] at com.sun.tools.javac.code.Printer.visit(Printer.java:136)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:193)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:161)
[junit] at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
[junit] at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:179)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:161)
[junit] at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
[junit] at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMeta(BasicDiagnosticFormatter.java:184)
[junit] at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatDiagnostic(BasicDiagnosticFormatter.java:100)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.format(AbstractDiagnosticFormatter.java:117)
[junit] at com.sun.tools.javac.util.AbstractDiagnosticFormatter.format(AbstractDiagnosticFormatter.java:69)
[junit] at com.sun.tools.javac.util.JCDiagnostic.toString(JCDiagnostic.java:537)
[junit] at com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.toString(ClientCodeWrapper.java:600)
[junit] at checkers.util.test.CheckerTest.assertDiagnostics(CheckerTest.java:286)
[junit] at checkers.util.test.CheckerTest.checkTestResult(CheckerTest.java:200)
[junit] at checkers.util.test.CheckerTest.runTest(CheckerTest.java:134)
[junit] at checkers.util.test.CheckerTest.test(CheckerTest.java:65)
[junit] at checkers.util.test.ParameterizedCheckerTest.run(ParameterizedCheckerTest.java:25)
(Note that I applied your patch against jsr308-langtools, so some of
these line numbers might be off. JavaCompiler.java is unchanged.)
I didn't see a performance difference when running the unit tests.
Best regards,
cu, WMD.
On Thu, Mar 6, 2014 at 4:22 PM, Jan Lahoda <jan.lahoda at oracle.com> wrote:
> Hi Werner and others,
>
> Currently, most of javac's services and data get cleared between annotation
> processing rounds. Lately, I've been working on a patch that would allow to
> keep as much as possible across rounds. The advantages include faster
> compilation (as ClassSymbols from classpath don't need to be read again and
> again for each annotation processing round) and cleaner javac internals.
>
> My current patch is available here:
> http://cr.openjdk.java.net/~jlahoda/2206926/webrev.01/
>
> The patch should be applicable to current jdk9/dev/langtools and current
> type-annotations/langtools.
>
> Any comments on the patch, or practical experiences running the Checker
> Framework (or any other annotation processor/framework) on a javac with this
> patch are very welcome and would be greatly appreciated.
>
> Thanks,
> Jan
--
http://www.google.com/profiles/wdietl
More information about the type-annotations-dev
mailing list