Change in behavior of javax.tools.JavaCompiler in JDK 8 running with -proc:only ?

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Mar 11 18:24:35 UTC 2014


Boaz,

In JDK 8, javac is more aggressive about reporting errors (and stopping 
the compilation) if the errors cannot be fixed by running annotation 
processors. This should not be an issue if you are using anno processors 
for generating code.

What sort of errors are you seeing in your compilation?

-- Jon

On 03/11/2014 08:27 AM, Boaz Nahum wrote:
> Hi
>
> I hope some can give me hint how anlyse our probelms with JDK 8.
>
> We use some code like this to do annotation processing (for generating 
> code):
>
>             JavaCompiler.CompilationTask task =
>                 javaCompiler.getTask(null, fileManager, diagnostics, 
> optionsAsList, null, compilationUnits);
>
>             BuildingBlockParamProcessor processor = new 
> BuildingBlockParamProcessor();
>             List<Processor> processors = new ArrayList<Processor>();
>             processors.add(processor);
>             task.setProcessors(processors);
> if(!task.call()){ .... }
>
> The code we try to process won't be compile in regular environment - a 
> lot of stuff is missing from classpath.
> But that is OK, we use '-proc:only' and we *thought* that this what 
> allows us to ignore the errors.
>
>
> When we moved to JDK 8, the exact code fails, 
> javax.tools.JavaCompiler.CompilationTask#call returns false.
>
> *My question, is a possibilty that '-proc:only' is ignored in JDK 8 ?
> *
> *Or maybe there is by-design change regarding annotation processing 
> that we need to be aware of ?
> *
> I want to mention that if the early EAP of JDK 8 , this code run 
> without any problems.
>
> (Moving to annotation processing during compilation is big effort for us)
>
> Any tip/hint will be appreciatively accepted
>
> Thanks
> Boaz
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140311/c8773b5a/attachment.html>


More information about the compiler-dev mailing list