participate


Annotation Processing - Where the default location of generated source files?
This question is answered.

<<   Back to Forum  |   Give us Feedback
This topic has 1 reply on 1 page.
Maxoid2
Posts:2
Registered: 6/3/08
Where the default location of generated source files?   
Jun 3, 2008 10:35 PM
 
 
Hello!
In my processor I create several source files and check it's names for existance before
private String genClassName( final String packageName, final String key, final String suffix )
    {
        final StringBuilder suggest = new StringBuilder( packageName ).append( key ).append( suffix );
        final Elements elementsUtil = processingEnv.getElementUtils();
        int i = 0;
        while( elementsUtil.getTypeElement( suggest ) != null )
        {
            suggest.append( i++ );
        }
        return suggest.substring( packageName.length() );
    }


If I not define -s option for javac at first time compile and then set it to some location, then some generated before files are visible for this method and numbers added.

So, the question: where to find a default "shadow" source tree to clean up it before next compilation with changed -s option?

Sorry for my english and thanks for answers

Edited by: Maxoid2 on Jun 3, 2008 10:34 PM
 
brucechapman
Posts:683
Registered: 11/24/98
Re: Where the default location of generated source files?   
Jun 4, 2008 3:49 PM (reply 1 of 1)  (In reply to original post )
Helpful
 
The directory to clean up is where the -s option pointed to last time.

The simplest way to do this is to always use the -s option and don't change it. Using the default value for -s option (which is the same as -d) tends to lead to problems. I always specify -s option, and make it different to -d option and -sourcepath.

If you do this you don't even have to clean it up, javac only looks in there for files that it placed there. Files from previous builds get overwritten. Files from previous builds that are not overwritten are ignored.

with a separate -s directory, it just works.

Bruce
 
This topic has 1 reply on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 23
  • Guests : 117

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums