-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Reintroduce compile dependency on apiguardian-api in Maven POMs #1105
Comments
Team decision: Try if we can get rid of these warnings by removing the static imports of |
I doubt that will work. What would work is to let |
I tried removing the static imports but it doesn't help. I see the following possibilities:
@junit-team/junit-lambda Thoughts? |
Not part of JUnit team, but if option 3 solves the problem, then I would vote for that... |
+1 for option 3 as well ... maybe w/o the Replace
|
Option 4 can be provided along with option 3. Something like:
The string values could be mapped to well-known annotation at inspection-time (ignoring characters case) and unknown string values can be collected and reported by an inspection tool. That enables custom categories. |
I like the individual annotations in
|
Guava made their annotation dependencies non-optional earlier this year - it might be worth looking over what was discussed there, if not done so already. I, too, like the individual annotation suggestion as mentioned above - the only issue with it is the collision with |
To fix the collision, we could call them |
Is there a reason that the dependency on the API enums can't be made |
Yes, that would definitely work, technically speaking; however, that would require that we release version 2.0 of the API Guardian. I'm not a fan of doing that, so I'd like to continue to investigate other options before we do anything that drastic. |
That's certainly an interesting idea.... and clever if it works. 😉
If you could let us know your findings, that would be great! |
I've created a sample project that scopes apiguardian-api as provided per the discussion above at https://github.com/selesy/apiguardian-provided. This project provides a library that's annotated with apiguardian-api and a consuming application that does NOT include in it's dependencies. Compile both the annotated library and application using the following command at the top-level directory:
Switch to the consuming application's directory and view the project's resolved dependency hierarchy using the following command and noting that apiguardian-api is not included:
This command shows the following output:
And verify that the consuming application executes properly with the following command:
This command results in the following output:
I've also verified that switching the apiguardian-api's scope to compile does indeed add the JAR back into the classpath. Did I miss anything? |
Thanks for the experiment, @smoyer64! I'm not an expert on the |
Yes ... but some further testing (added to the above referenced project) shows that it doesn't work the way I thought it did. Unfortunately, I also can't find that this behavior is part of the specification. The JVM specification defines a Since the Since the specifications state that annotations don't affect the run-time behavior of the program, the behavior described above makes sense, so I feel pretty safe marking apiguardian-api as |
That's a different issue. The builds that publish warnings about the I haven't had a chance to look into your Thanks for investigating and sharing your findings! |
Yes ... more proof that provided scope didn't include it on the classpath ;) What I meant is that it's going to be obvious that the annotation and enum are missing if someone is specifically trying to use these types. |
👍 |
Does |
My assumption is that Gradle treats |
And when I say "ignores it", I mean in a way that doesn't help us. 😇 |
@sbrannen - That was a very diplomatic way of saying I didn't understand the original problem ;) |
Ahhhh... well... that wasn't my intention. I was actually just thinking out loud in response to Marc's question. |
No worries ... one of the comments earlier made me wonder whether the warnings would actually be solved using provided. I'm a bit of a Gradle newb so everything looks like a Maven to me! |
After further consideration, I believe the best we can do is revert the changes in #1065. Even if this "bug" (or perhaps just an unintentional inconvenience) in the Java compiler does get addressed, that may never get implemented in Java 8 and may potentially not show up for public consumption until Java 10 or Java 11. In summary, reverting the changes in #1065 is IMHO the lesser of the two evils (where # 1 is reverting and # 2 is releasing API Guardian 2.0 with breaking changes). @junit-team/junit-lambda, any objections to reverting the changes in #1065? |
No objections from me. |
👍 @marcphilipp, this issue is currently assigned to you. Do you want to tackle this one? |
I'm on it. |
Overview
Consider reverting the changes in #1065.
See discussions on Gitter and elsewhere.
Deliverables
compile
dependency onapiguardian-api
in generated Maven POMs.The text was updated successfully, but these errors were encountered: