Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Why was the Annotation processing in Eclipse made so different from javac?

Not an answer to your question, but I will most likely disable
annotation processing by default in Maven and I am undecided if
annotation processors will be looked up in project dependencies or not yet.

There are several issues with default behaviour in javac, at least in Maven

* it is not thread safe in java 6, so you can't really run your built in
parallel mode unless you are sure there are no annotation processors on
classpath. granted, this is solved in java 7, but many builds are still
stuck on java 6.

* incremental build becomes much harder if not impossible without
annotation processor API changes. Changes to annotation processors, or
anything they execute, should trigger regeneration of the classes they
generate. This is doable when annotation processors come from separate
classpath, but becomes a problem when annotation processors can come
from other reactor projects.

--
Regards,
Igor

On 2014-03-15, 7:57, Ilya Basin wrote:
Hello. I already asked this in the forum, but got no reply. http://www.eclipse.org/forums/index.php/t/665448/

Why annotation processing is off by default? One could say the
opposite would slow down things, but isn't a better trigger to enable
the processing - the presence of unknown annotations in the source
code (not @Override, @Deprecated etc.)? Other annotations are rare and
for most projects the processing would be inactive.

Why the project classpath is not used to find the annotation processors?
Perfomance again? Is it really slow to check for the file
"javax.annotation.processing.Processor" in the whole classpath?
Well, at least, in normal eclipse project this can be solved by
adding .factorypath under source control.
More problematic are maven projects. If it's a popular annotation
processor (like JPA) then it even works out of the box, because the
plugin supports it. But no custom annotations for us!

Why java projects can't be added to Factory Path? Why only jars are allowed?
I even tried to add custom ant builder to make me a jar, but this
doesn't work, because the Factory Path of a project is loaded BEFORE
the dependencies are built and for the edits in the custom processors
to take effect I had to restart eclipse.

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-core-dev



Back to the top