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

processing of annotations #60

Closed
swolf91 opened this issue Oct 12, 2014 · 12 comments
Closed

processing of annotations #60

swolf91 opened this issue Oct 12, 2014 · 12 comments

Comments

@swolf91
Copy link
Contributor

swolf91 commented Oct 12, 2014

I found a bug with the processing of annotations.
In my project I've a class AnnotationProcess which extends the AbstractProcessor<CtAnnotation<?>>

Imagine you've the following annotations:

public @interface OuterAnnotation
{
    public MiddleAnnotation[] value();
}

public @interface MiddleAnnotation
{
    public InnerAnnotation value();
}

public @interface InnerAnnotation
{
    public String value();
}

The processing of the InnerAnnotation doesn't work if the MiddleAnnotation is used as an array. So the processor isn't invoked with the InnerAnnotation.

examples:

@OuterAnnotation(@MiddleAnnotation(@InnerAnnotation("hello")))
public void test() // The InnerAnnotation will be processed
{}

@OuterAnnotation({@MiddleAnnotation(@InnerAnnotation("hello")), @MiddleAnnotation(@InnerAnnotation("hello again"))})
public void test2() // The InnerAnnotation won't be processed
{}
@petitpre petitpre reopened this Oct 13, 2014
@GerardPaligot
Copy link
Contributor

I also tested and I confirm the bug. If you don't make a PR, I add it in my to-do list. :)

Thanks for reporting this bug.

@swolf91
Copy link
Contributor Author

swolf91 commented Oct 14, 2014

@GerardPaligot At the moment I don't work on that. So you can add it to your todo list.
If I start working on it I'll let you know or rather I'll ask for the status before.

@KonstantinSviridov
Copy link

+1
Actually, arrays of annotations are not captured at all, because CtNewArray is only allowed to contain CtExpressons while CtAnnotation does not extend it.

@petitpre
Copy link
Contributor

petitpre commented Nov 4, 2014

Is it fixes by the pull request #83?

@swolf91
Copy link
Contributor Author

swolf91 commented Nov 4, 2014

@petitpre No, #83 doesn't fix this. Have a look at #82 to get a short description about the difference.

@swolf91
Copy link
Contributor Author

swolf91 commented Dec 26, 2014

@GerardPaligot Did you have a look how to fix this issue already?

@GerardPaligot
Copy link
Contributor

I'm working on it today. I identified the problem but the solution is a little bit tricky. PR probably soon.

@ocean7
Copy link

ocean7 commented Jan 7, 2015

Want to +1 Konstantin's comment (#60 (comment)) arrays of annotations aren't being captured at all.

@KonstantinSviridov
Copy link

Hi guys.

What is the spoon version which has this issue fixed?
It does not work for me with 3.0:

<dependency>
    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-core</artifactId>
    <version>3.0</version>
</dependency>

@GerardPaligot
Copy link
Contributor

Hi @KonstantinSviridov,

Did you test the version 3.1?

@KonstantinSviridov
Copy link

@GerardPaligot, thank you. With 3.1 it is fine.

@GerardPaligot
Copy link
Contributor

It's our fault, the website isn't updated with this version. This will be fixed very soon.

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

No branches or pull requests

5 participants