-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Copy non AA annotations in generated class #982
Copy non AA annotations in generated class #982
Conversation
Annotations on class, methods and method parameters are copied in generated class. SubscribeHandler and ProduceHandler are no longer necessaries.
We are copying all annotations to overriden classes, methods, method arguments etc, what are not from our package. This commit adds the ability to AA to copy the annotation parameters, too. Note that annotation as an annotation parameter is not supported yet.
|
I proposed a PR for copying annotation parameters, yDelouis#1. |
Adding parameters to copied annotations
…782_otherAnnotations
|
I am wondering, does this help us to integrate with |
|
This may help integrate Dagger only if every annotated method are propagated in the generated class, because Dagger doesn't look at inherited class's methods. However, this PR was about propagating non-AA annotations on generated methods. And it seems to work great 👍 |
Copy non AA annotations in generated class
|
I cannot understand, Why we should copy AA annotations, too? |
|
My mistake, as AA annotations should already been processed, we don't have to propagate them :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override
@UiThread
public void doSomething() {
// ...
}after annotation processing, @Override annotated twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed with #1001
|
I have a problem with copying non-AA annotations to generated class. I have a custom annotation with parameters , one of them refers to another AA-Generated class. This parameter is not copied to generated class correctly (maybe since the AA-class is generated before the referred AA-class). In the end the Annotation looks like @MyAnnotation(param = ) which obviously breaks the code. Ultimately I had to disable copying of the annotations with parameters (in my aa-fork) to avoid the problem. Can this be fixed? If not, can we find some compromise? For instance - do not copy annotations which are @inherited (since they can sill be discovered) without propagation to generated class? |
|
Your last idea seems good to me (not copying annotations with |
|
never done anything like that before, but I could try on weekend and may be post a patch here? |
|
What if the annotation is not inherited but still needs a generated class |
|
than the aa code has to be fixed to support that. this is an obvious solution but since I have no idea if it is possible (to be honest I looked into the code only to disable annotations with params) - the workaround could be to omit at least @inherited annotations. |
|
OK guys, we should a new issue about this. |
|
do you want me to do this? |
|
If you don't mind. ;) |
|
well, it won't take long anyway ;) |
This PR makes AA copy non AA annotations in generated classes as requested in issue #782.
This enables runtime annotations to work as if the class was written by the developer and other annotations processor to process generated class.