Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Building Annotation Processing Tool plug-in with JDT
Building Annotation Processing Tool plug-in with JDT [message #198180] Thu, 10 March 2005 04:08
Eclipse UserFriend
Originally posted by: tyeung.bea.com

I am trying to build the Annotation Processing Tool (APT) as a plug-in to
the JDT and have run into a few questions.
(http://java.sun.com/j2se/1.5.0/docs/guide/apt/)

Annotation processing is a post-compilation process on a
(java)CompilationUnit. Ideally, the plug-in is invoked on every source
file compiled by the Java builder (anytime after a full resolve is
completed) or when an ElementChangeEvent occur. In either case, the
processing requires resolve data (the resolved AST with binding
information).

Let's focus on the project build scenario since it is the more complicated
case.

Currently, there doesn't seem to be any notification events occuring
during build that would include resolution data. (There is the progress
monitor, but that doesn't suffice.)

Q1: Is it possible to have a listener that listen on a build events on a
per file basis and have the resolved AST available?

APT could also introduce file dependencies which are addition to those
occurred during regular java compilation.

Q2: Does the JDT plan to expose the dependency tracking infrastructure in
the public domain?

The more interesting question is what exactly APT want to do with the
dependencies. Since APT can cause the generation of new types, files that
have already been compiled in a build will be required to be recompiled.
For example, File A.java has an annotation and when APT is ran, AA.java
gets generated and created type x.y.z.AA. As a result, every file that
have a package dependency on the package x.y.z will need to be recompiled.

Q3: How could a plug-in modify, mainly add to, the list of source files to
be compiled during a build?

There are two approachs to exposing the dependency tracking
infrastructure, 1) allowing only read access and 2) exposing both read and
write access for the plug-in. The second on seems to be more aggressive
but it seems at least read access is required to support APT. The reason
for exposing write access is that dependencies occured during APT
processing should be treated no different from regular dependencies and
the JDT seems to be the most logical place to hold this information.

One last question. APT support the creation of wildcards and parameterized
type and I noticed that AST.java supports the creation wildcard and
parameterized type, but only if the wildcard has no bounds and the type
has no type parameter.

Q4: How could I compose the type "List<? extends String>" or
"List<String>" from scratch?


Thanks for your attention.

Theodora Yeung
BEA Systems
Previous Topic:odd problem over RemoteDesktop
Next Topic:generated method parameters
Goto Forum:
  


Current Time: Wed Jul 17 12:48:42 GMT 2024

Powered by FUDForum. Page generated in 0.02762 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top