Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using JDT-APT to generate code
Using JDT-APT to generate code [message #724492] Mon, 12 September 2011 09:17 Go to next message
Eclipse UserFriend
Hi all,

I need a annotation processing tool with the possibility to generate source code.
What I want to do is to process specific annotations *and* generate boilerplate code to the newly introduced classes that I plan to use via ServiceLoader.

In fact, I can do that with Open JDK (by using the standard annotation processing facility which is built-in to the javac compiler starting from the Java 6), but deep type introspection and code generations require to use sun-specific classes (basically com.sun.tools.javac.*) which obviously is an ugly hack, not to mention that
(1) they change internal AST and Type tree representations from release to release
(2) the interface to internal AST (JCTree descendants) is ugly - most classes expose public fields, extensively use bit flags and have complex and cluttered API.

I believe that there is a better way to do that (annotations processing + type (AST) introspection + code generation) but I don't know what tool I should use, maybe eclipse JDT APT allows doing so in well-defined and standardized manner?

P.S.: I'm using maven and I'd like to do that in IDE-independent way.
P.P.S: Downgrading to JDK 5 is inappropriate.
Re: Using JDT-APT to generate code [message #725166 is a reply to message #724492] Wed, 14 September 2011 02:40 Go to previous message
Eclipse UserFriend
If you want to do it in an IDE-independent way, you have to go the way of standard annotation processing provided by javac. JDT-APT allows annotation processors written for javac to be used with Eclipse.
Previous Topic:Setup of Environment
Next Topic:How to identify unused properties in eclipse
Goto Forum:
  


Current Time: Sat Jul 19 21:58:56 EDT 2025

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

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

Back to the top