Click here to Skip to main content
14,239,593 members
Rate this:
Please Sign up or sign in to vote.
I was playing around with annotation processing and was unable to use generated files directly via an import in my code. Instead I had to prepend the generated classes with its complete package. I (accidentally) figured out the reason for this, turned out to be pretty simple, the error was because I was generating the files at last round of AbstractProcessor. What I had to do was generate files at each round.

So my questions are:

  • Are there more differences in generating files at last round vs generating files before the last round?
  • Is there a specific reason (Java-related or otherwise) for this behavior?

I know from the warning that new rounds will not run even if the annotation is present in the new generated files, however I still don't understand how generating files at only the last round changes the way I access classes.

In case it is relevant, I'm working on an Android Project in Android Studio and using JavaPoet to write classes.

What I have tried:

I posted two SO questions:
error: package generated.schema does not exist.
But then I figured out the answer on my own and then I posted a follow up question
AnnotationProcessing - Generating Files at Each Round vs at Last Round

I've also gone through a few tutorials on Annotation Processing but I haven't been able to find anything either explaining or hinting at this behavior.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100