siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
694 stars 107 forks source link

Filter for full annotations #356

Open vajnaivik opened 1 year ago

vajnaivik commented 1 year ago

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?

siom79 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

vajnaivik commented 1 year ago

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 commented 7 months ago

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)
...