Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes generated in the last round, so they are not processed #85

Closed
dlemures opened this issue May 25, 2016 · 5 comments
Closed

Classes generated in the last round, so they are not processed #85

dlemures opened this issue May 25, 2016 · 5 comments
Labels
Milestone

Comments

@dlemures
Copy link
Collaborator

Some classes are generated in the last round, so they are not processed.

Example:

[ERROR] [system.err] warning: File for type 'toothpick.data.FooWithProvider$$MemberInjector' 
created in the last round will not be subject to annotation processing.
@dlemures dlemures added the bug label May 25, 2016
@dlemures dlemures added this to the 1.0.0-RC3 milestone May 25, 2016
@stephanenicolas
Copy link
Owner

http://stackoverflow.com/a/16114496/693752

In our case I think we can create the code in the first round even.

No generated code, AFAIK, is gonna be annotated with "our" annotations so we will see all files to parse in the first round if my understanding is correct.

The ideal fix would be to create any needed new generated code during each stage.

@dlemures dlemures modified the milestones: 1.0.0-RC4, 1.0.0-RC3 Jun 24, 2016
@eygraber
Copy link
Contributor

Is this why MemberInjectorRegistry and FactoryRegistry have to be fully qualified instead of being imported?

@atomd-zz
Copy link

+1

@stephanenicolas
Copy link
Owner

I didn't get what you mean. This issue is about à warning message during
annotation processing. Nothing big.

The problème you mention is about how the IDE deals with generated code.

Le lun. 22 août 2016 19:14, Duan Wenbo notifications@github.com a écrit :

+1


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#85 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABv33Zv6TDgVCyHIIjQKlbmHDzta1Zixks5qiklfgaJpZM4Imzj1
.

@stephanenicolas
Copy link
Owner

There is nothing we can do against this warning because it would break the possibility for any OTHER annotation processor to generate code using @Inject.

Annotation processing rounds are constructed this way:

  • first an annotation processing round will report all annotations being used in the source code.
  • if an annotation processor generates code, and this contains annotations, then a second round is constructed and it reports these annotations.
  • and so on
  • until there is no more new annotations to be reported, then a last round is constructed.

We can be optimistic and generate MemberInjectors and Factories during every round of annotation processing. That would work as all annotations in the each source file are supposed to be reported during the same round.

But to generate the registries, we still need ALL member injectors or factories. So if there is any OTHER annotation processor that generates code using @Inject annotations, we woud need to add their registries and factories. The only appropriate place to generate the registries is last round.

We also tried to use a trick mentioned in : http://stackoverflow.com/a/16114496/693752
But it doesn't work: if we create the registries as resource files, then they are not being compiled by javac or at least, the AST creation phase of javac doesn't understand that a type will be created, and this type can't be used in source code, which makes it impossible to reference the registries from the source code and TP needs it.

So, I close this issue as there is absolutely nothing that can be done against this issue. We will always have to generate the registries during the last round, unless we assume that there is only one possible round of annotation processing for the inject annotation, which would prevent any other annotation processor to generate code using @injects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants