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

Introduce tools for @API annotation processing #144

Closed
jlink opened this issue Feb 1, 2016 · 12 comments
Closed

Introduce tools for @API annotation processing #144

jlink opened this issue Feb 1, 2016 · 12 comments

Comments

@jlink
Copy link
Contributor

jlink commented Feb 1, 2016

Do something useful with @API annotations, e.g.

  • Extract all public APIs
  • Compare two versions of JUnit 5 for release notes
  • Check correct usage of APIs (internally and externally)
@jlink jlink added this to the 5.0 M1 milestone Feb 1, 2016
@jlink jlink modified the milestones: 5.0 Backlog, 5.0 M1 Mar 16, 2016
@sbrannen sbrannen changed the title Tools for API annotation processing Introduce tools for @API annotation processing Jul 16, 2016
@sbrannen
Copy link
Member

FYI: this issue is related to #436.

@smoyer64
Copy link
Contributor

smoyer64 commented Nov 8, 2016

As noted in PR #564, I've started working on a small set of tools to perform the functions listed above. As I've been working through that code, I found that I have a few more questions:

  • Should @API also be applied to protected-scoped and package-scoped elements as well as publicly-scoped elements? I can argue both ways on this one but if the policy is that you only use public fields, methods, constructors that are not annotated with Usage.INTERNAL (or Usage.EXPERIMENTAL/Usage.DEPRECATED at your own risk), then it's relatively safe to assume the elements needed are going to be public.
  • It's clearly stated that if an element isn't annotated explicitly with @API, it's inherited from the enclosing class. I'll also walk the inheritance hierarchy to find the annotation if needed. But what about methods and constructors that are @OverRide? I think one of the important uses of @API is to encourage extension authors to continue to use @API but the application of the annotation will need to be unambiguously define. The implementation of interfaces in some ways recreates the "diamond problem" for @API.

@marcphilipp
Copy link
Member

Should @API also be applied to protected-scoped and package-scoped elements as well as publicly-scoped elements?

There's (at least) two ways to look at it: (1) protected-/package-scoped elements are implicitly annotated with @API(Internal), or (2) we only look at public elements. I think either way, the outcome is the same, right?

It's clearly stated that if an element isn't annotated explicitly with @API, it's inherited from the enclosing class. I'll also walk the inheritance hierarchy to find the annotation if needed. But what about methods and constructors that are @OverRide?

I think we should enforce that an overridden method needs to explicitly re-declare an @API annotation.

@junit-team/junit-lambda What do you think?

@smoyer64
Copy link
Contributor

@marcphilipp

I think we should enforce that an overridden method needs to explicitly re-declare an @API annotation.

As I've gotten a bit deeper into this coding, I agree that explicitly overridden methods should re-declare the @API annotation. This should also apply to interface method implementations as it eliminates a form of "the diamond problem".

I was hoping to be able to "lint" M3 but I'm not sure I'll finish in time for that.

@33epico
Copy link

33epico commented Nov 23, 2016

Hi all:

I just finish muy java SE study, I would like to help and learn in any open source project. I just arrive here surfing the web and I am a little bit lost. Please anybody can give to me a path to help in this kind of proyects.

Thanks in advance

@jbduncan
Copy link
Contributor

Hi @33epico, it's not clear to me how much experience you have with Java, but I think this issue in which @JingMa87 asked a similar question may prove to be a good starting point for you.

If after reading it you're still confused or have any specific questions, please feel free to raise a new issue, and I'm sure someone can give you more information on finding your way in the world of open source development. :)

@33epico
Copy link

33epico commented Nov 24, 2016

thanks a lot @jbduncan I just read the @JingMa87 post and its ok, Im gonne to read the documentation and start using the Junit5 to know it at all.

Regards!!

@JingMa87
Copy link

Good luck @33epico! 😄

@marcphilipp marcphilipp modified the milestones: 5.1+ Backlog, 5.0 M5 Dec 22, 2016
@amirhmd
Copy link

amirhmd commented Feb 6, 2017

Hi there, anybody could tell me how can i contribute in this project?
thanks in advance,
Amir

@jbduncan
Copy link
Contributor

jbduncan commented Feb 6, 2017

Hi @amirhmd, welcome!

I'd personally recommend you read through this issue first, where I suggested a bunch of (hopefully) useful starting points for contributing to JUnit 5.

If, after reading through it, you're still not clear on what or how you could contribute, then please feel free to ask for more help by commenting here again or raising a new issue.

(You could even say something as simple as "Sorry, I'm still confused on what I can do to contribute to JUnit 5, so can I have some more help please?", and that would be perfectly fine!)

Hope this helps. :)

@marcphilipp marcphilipp removed this from the 5.0 M5 milestone May 6, 2017
@sbrannen sbrannen modified the milestones: 5.0 M6, 5.0 RC1 Jul 3, 2017
@sbrannen sbrannen modified the milestones: 5.0 RC1, 5.0 GA Jul 29, 2017
@sbrannen
Copy link
Member

sbrannen commented Sep 1, 2017

FYI: @sormuras and I have put together a proof of concept (PoC) for generating reports on declarations of @API within a given project (potentially across multiple modules).

The PoC is capable of generating snippets for inclusion in Markdown, Asciidoc, and HTML documents.

An example of the generated Markdown can be seen here: #856 (comment) (note: you have to expand the Details section in the comment).

An example of the generated Asciidoc can be seen here: http://junit.org/junit5/docs/snapshot/user-guide/#api-evolution-experimental-apis

And the code that generates these snippets can currently be found here: https://github.com/junit-team/junit5/tree/master/platform-tests/src/test/java/org/junit/api/tools

@marcphilipp marcphilipp modified the milestones: 5.0 GA, 5.1 Backlog Sep 7, 2017
@sbrannen sbrannen modified the milestones: 5.1 Backlog, 5.1 M1 Sep 20, 2017
@sbrannen
Copy link
Member

Closing this issue in favor of apiguardian-team/apiguardian#2.

Please continue the discussions there.

@sbrannen sbrannen removed this from the 5.1 M1 milestone Sep 20, 2017
@junit-team junit-team locked and limited conversation to collaborators Sep 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants