Bug 172369 - Adding an extension point to register an annotation processor inside the java builder
Summary: Adding an extension point to register an annotation processor inside the java...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-31 14:55 EST by Olivier Thomann CLA
Modified: 2007-02-06 09:09 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix (3.52 KB, application/octet-stream)
2007-01-31 14:55 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2007-01-31 14:55:05 EST
In order to use the annotation processor manager from the org.eclipse.jdt.compiler.apt project inside org.eclipse.jdt.core, we need to add an extension point that will allow the classes from org.eclipse.jdt.compiler.apt to be used inside org.eclipse.jdt.core without having org.eclipse.jdt.code depending on org.eclipse.jdt.compiler.apt.
Comment 1 Olivier Thomann CLA 2007-01-31 14:55:50 EST
Created attachment 57937 [details]
Proposed fix

Zip file that contains the patch.
Comment 2 Olivier Thomann CLA 2007-01-31 14:59:57 EST
Walter will add examples and more documentation post M5.
Comment 3 Olivier Thomann CLA 2007-01-31 15:00:16 EST
Released for 3.3M5.
Comment 4 Walter Harley CLA 2007-01-31 15:15:06 EST
I also considered some other possibilities. 

The basic requirement is that jdt.core needs access to a service in compiler.apt, but cannot be dependent on compiler.apt.  This is of course the canonical use case for an extension point. 

We could use the existing compilationParticipant API as a way of loading the compiler.apt plug-in, and compiler.apt could then register its annotation processor manager with jdt.core through some registration method.  But it is not obvious what JDT object should expose the method; and also, this seems circuitous and misleading, since it requires compiler.apt to register an extension that it doesn't actually support.

There are also some service bus interfaces supported by OSGi that are somewhat similar to the "META-INF/services" mechanism in Java.  However, these all seem to require registration on the part of the callee, which again means that it must extend some sort of extension point in order to wake up and register itself.

Eventually, all roads returned to the need for an extension point, and rather than abuse an existing extension point it seems best to create a correct one.
Comment 5 Walter Harley CLA 2007-01-31 15:26:24 EST
I should also mention why Java 6 annotation processing isn't simply implemented
as a CompilationParticipant.  The reason is that in order for it to be used in
batch mode, it has to run without the Eclipse platform present, so it needs
access to the JDT compiler internal typesystem, rather than the Java model. 
(We also expect this to lead to performance and correctness improvements.) 
Therefore it runs at a different point in the compilation process, and the
definition of the interface is different (e.g., CompilationParticipant depends
on IJavaProject). 
Comment 6 Eric Jodet CLA 2007-02-06 07:57:48 EST
Verified for 3.3 M5 using build I20070205-0009