Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » APT with Java 5
APT with Java 5 [message #257156] Mon, 03 November 2008 04:56 Go to next message
Eclipse UserFriend
Hi,

On a Eclipse 3.3-based product, I need to develop an annotation processor.
I tried following the example at xxx. What I found out is that I need the
org.eclipse.jdt.compiler.tool, which seems to require Java 6. On the Mac,
Java 6 is 64-bit only, and until SWT/Cocoa is up, I'm stuck with the
32-bit SWT/Carbon and Java 5 to run Eclipse. Does it mean I can't use
org.eclipse.jdt.compiler.tool? Or should I look for an older version of
org.eclipse.jdt.compiler.tool?

Thanks in advance,
J.-P.
Re: APT with Java 5 [message #257187 is a reply to message #257156] Mon, 03 November 2008 04:57 Go to previous messageGo to next message
Eclipse UserFriend
I meant: the tutorial at http://www.eclipse.org/jdt/apt/index.html.
Re: APT with Java 5 [message #257210 is a reply to message #257156] Tue, 04 November 2008 11:36 Go to previous messageGo to next message
Eclipse UserFriend
"J.-P. Pellet" <jpp-mac@gmx.net> wrote in message
news:2993885120fe47ed7866d8a49fa6ae84$1@www.eclipse.org...
> Hi,
>
> On a Eclipse 3.3-based product, I need to develop an annotation processor.
> I tried following the example at xxx. What I found out is that I need the
> org.eclipse.jdt.compiler.tool, which seems to require Java 6. On the Mac,
> Java 6 is 64-bit only, and until SWT/Cocoa is up, I'm stuck with the
> 32-bit SWT/Carbon and Java 5 to run Eclipse. Does it mean I can't use
> org.eclipse.jdt.compiler.tool? Or should I look for an older version of
> org.eclipse.jdt.compiler.tool?

One option is to write your processor to run against the Java 5 annotation
processing API, that is, com.sun.mirror.apt.*. This is detailed in the APT
tutorial, I believe.

If you want to execute an annotation processor that is written against the
Java 6 APT API, unfortunately you do need to be running Eclipse on Java 6.
Technically you could *write* an annotation processor while running Eclipse
on a lower-version JVM, but it might be challenging to debug it. The reason
for this is that to run the annotation processor as part of the compilation,
we have to load the APT interface classes (e.g.,
javax.annotation.processing.*), and they're not available on Java 5.

It is possible to run Java 6 annotation processors on Mac if you use the
command-line Eclipse compiler, ecj.jar. So depending on your application,
you might be able to run APT from time to time at the command line and then
use the IDE the rest of the time.

And finally, you might want to give Eclipse 3.5 M3 a try - I thought they'd
gotten the Cocoa port somewhat working for that. I doubt that anyone has
tried Java 6 annotation processors in the Mac Eclipse IDE yet, so if you
encounter problems, do report them in Bugzilla.

If any of that's unclear, let me know why and I'll clarify.

Thanks,
Walter Harley
JDT APT lead
Re: APT with Java 5 [message #257757 is a reply to message #257210] Thu, 11 December 2008 16:21 Go to previous message
Eclipse UserFriend
Walter Harley wrote:

> One option is to write your processor to run against the Java 5 annotation
> processing API, that is, com.sun.mirror.apt.*. This is detailed in the APT
> tutorial, I believe.

Hi Walter,

Thanks a lot for your detailed answer. The thing is, even if I run against
the Java 5 API, the com.sun.mirror.apt.* classes I need are defined in the
jdt.apt.core plugin, right? And this plugin lists JavaSE-1.6 as needed
execution environment. Funny enough, my Java 5 annotation processor works
fine, even if I get the warning about this unresolved dependency. What am
I missing here?

Thanks,
J.-P.
Previous Topic:key => IBinding?
Next Topic:Getting from SVN to JDT
Goto Forum:
  


Current Time: Wed May 07 04:23:16 EDT 2025

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

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

Back to the top