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

Filter for full annotations #356

Open
vajnaivik opened this issue Jan 17, 2023 · 5 comments
Open

Filter for full annotations #356

vajnaivik opened this issue Jan 17, 2023 · 5 comments

Comments

@vajnaivik
Copy link

vajnaivik commented Jan 17, 2023

I have the following style of annotations on a project:
@Annotation(state = State.STABLE)

As far as I understand the code, filtering for something like this is not possible at the moment.
Do I understand this right, and will this be implemented in the future if so?

@vajnaivik vajnaivik changed the title Filter for annotation with property Filter for full annotations Jan 17, 2023
@siom79
Copy link
Owner

siom79 commented Jan 17, 2023

You can filter for annotations with the following configuration (see here):

<includes>
    <include>@my.AnnotationToInclude</include>
</includes>

Filtering for values of elements of an annotation like state in your example is currently not possible.
Do you need it?

@vajnaivik
Copy link
Author

Thank you for the quick reply!
I found the annotation option, sorry for not clarifying that.

It would be a great convenience, the team I work with would probably start using the tool in that case.

By the way, I managed to filter out classes using the annotation with a groovy script, but japicmp.model.JApiMethod doesn't seem to include information about method annotations, so there is a half-way workaround at least.

@siom79
Copy link
Owner

siom79 commented Jan 19, 2023

Have you seen the attribute annotations of JApiMethod (see here)?

@vajnaivik
Copy link
Author

aww shucks
I didn't notice that at all!
Than the workaround should be possible.
I still don't know if the feature would be worth your time, but you can probably estimate that better.
Thanks for the help!

@reckart
Copy link

reckart commented Dec 22, 2023

Filtering for values of elements of an annotation like state in your example is currently not possible.
Do you need it?

Being able to filter out not only by annotation but also by attribute value would be great. It would make japicmp compatible with the ApiGuardian annotations which are used by a bunch of major OSS packages (e.g. JUnit 5 which is where I stumbled across them).

@API(status = Status.STABLE)
@API(status = Status.EXPERIMENTAL)
@API(status = Status.INTERNAL)
...

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

3 participants