Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Sources generated by APT are not compiled to output folder
Sources generated by APT are not compiled to output folder [message #255513] Mon, 11 August 2008 21:34 Go to next message
Eclipse UserFriend
Originally posted by: adv.zahn.googlemail.com

Hello,

I have a Java Project with an Annotation Processor, generating some
source code to a source folder. Unfortunately, the generated source code
is not compiled to the "bin" output folder.

The annotation processor is my own one, and after generating the source
code, I call the following lines:

final IFolder genFolder = ...;
if(null != genFolder)
try {
if(null != genFolder)
genFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException e1) {
...
}

What am I missing?


Greetings,
Ralf
Re: Sources generated by APT are not compiled to output folder [message #255517 is a reply to message #255513] Mon, 11 August 2008 21:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adv.zahn.googlemail.com

Okay, might be the fact that I do not use the filer, I just use a code
generator generating the source file into the folder.

Ralf Zahn schrieb:
> Hello,
>
> I have a Java Project with an Annotation Processor, generating some
> source code to a source folder. Unfortunately, the generated source code
> is not compiled to the "bin" output folder.
>
> The annotation processor is my own one, and after generating the source
> code, I call the following lines:
>
> final IFolder genFolder = ...;
> if(null != genFolder)
> try {
> if(null != genFolder)
> genFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
> } catch (CoreException e1) {
> ...
> }
>
> What am I missing?
>
>
> Greetings,
> Ralf
Re: Sources generated by APT are not compiled to output folder [message #255521 is a reply to message #255517] Tue, 12 August 2008 01:18 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
Ralf Zahn wrote:
> Okay, might be the fact that I do not use the filer, I just use a code
> generator generating the source file into the folder.

You definitely need to use Filer. It will not work otherwise. Filer
informs the Java compiler that new types have been created and restarts
the compilation loop.
Re: Sources generated by APT are not compiled to output folder [message #255524 is a reply to message #255521] Tue, 12 August 2008 09:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adv.zahn.googlemail.com

Okay, but I had to use another source folder because (in the Annotation
Processor) I call an external code generator that does not use the Filer
object.

Walter Harley schrieb:
> Ralf Zahn wrote:
>> Okay, might be the fact that I do not use the filer, I just use a code
>> generator generating the source file into the folder.
>
> You definitely need to use Filer. It will not work otherwise. Filer
> informs the Java compiler that new types have been created and restarts
> the compilation loop.
Re: Sources generated by APT are not compiled to output folder [message #255530 is a reply to message #255524] Tue, 12 August 2008 15:34 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Ralf Zahn" <adv.zahn@googlemail.com> wrote in message
news:g7rl1i$4ru$1@build.eclipse.org...
> Okay, but I had to use another source folder because (in the Annotation
> Processor) I call an external code generator that does not use the Filer
> object.

I understand your use case. Unfortunately this is a limitation of the way
that APT, and the Eclipse java compiler, work. If you want types generated
within an APT pass to be compiled, you need to generate them with the Filer.
I expect the same would be true, by the way, if you were using Sun's apt and
javac.

One option, if you can't change the external code generator, is have it
generate into a temp directory, and then have the annotation processor read
the contents of that directory and use Filer to generate the "real" files.
Previous Topic:How to define a variable for a user (or system) library
Next Topic:Augmenting Parser
Goto Forum:
  


Current Time: Mon Jul 08 14:26:50 GMT 2024

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

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

Back to the top