-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Caffeine 2.7.0 extra dependencies #300
Comments
The side effect should only be as benign runtime dependencies, unless you are seeing more issues? The intent was to follow Guava’s example which has https://github.com/google/guava/blob/2763649a49907a645b97afd860ca74257368ab45/guava/pom.xml#L33-L40 Some JVM languages can’t handle missing annotations so excluding causes surprising errors. The old jsr305 annotations are not module friendly so moving off was requested. Excluding should be safe and okay. Or did I screw something else up? |
You didn't screw up anything ;-) I was just making you aware of these dependencies being dragged now, since this seems to be a norm then close this issue, I'm also doing the same for Guava (excluding these explicitly) |
I’d prefer to have it as an optional dependency, but the thread on Guava shows it’s annoying for people either way... |
Having this issue, too:
In my opinion, ErrorProne should only be required by the compiler during compile time, but should not be deployed as required dependency, unless the caffeine.jar has imports from ErrorProne (which I doubt). The same might be true for the typesafe and checker-qual (seems like they only do some static code analysis). The issue is, that you when you collect all dependencies (e.g. with maven-dependency-plugin:copy-dependencies), e.g. for bundling and deploying your application, these libraries are included and delivered to the customer, although they are probably never needed. So, the preferred way is to explicitly exclude them? |
Unfortunately for Guava and sometime now Caffeine this is how I have them both declared, nothing has gone wrong with the applications when declared like this, so for now just exclude them:
|
checker-qual And errorprone are annotations which Java doesn’t require at runtime unless you reflectively load them when inspecting the methods. Unfortunately other languages will not classload without them, making them required. You can exclude safely in Java. Typesafe is a configuration library that is required for JCache. |
Can you please elaborate? Java specification says, that annotation is basically ignored if it cannot be loaded at runtime. |
The Scala compiler requires that all classes referenced in signatures https://www.scala-lang.org/old/node/10575 There is an ancient scalac bug that I can’t find atm. |
The closest bug I could find is newer than the one I recall, but similar And it was still an issue as of 2016, according to this blog post. I wouldn't be surprised if Kotlin has a similar issue since it is Scala inspired. Regardless, it made sense to follow Guava's lead when switching away from jsr305 annotations, which were in the |
Just in case, here are the cases for Guava google/guava#2824 and JUnit5 junit-team/junit5#1105 Both projects settled on making annotations available on the compile classpath. |
@ben-manes it looks like there was a side effect with some of the new checkers you added, or; was this intended? I have to explicitly exclude them now:
The text was updated successfully, but these errors were encountered: