-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Make error_prone_annotations dependency optional #1739
Conversation
Annotations with retention policy are ignored if they cannot be loaded at runtime. Make the dependency optional to not enforce the presence of error_prone_annotations in a java runtime even if those annotations are not used at all.
Thanks @HannesWell . If an alternative is proper OSGi info in error prone, could you update a PR there for doing that and let me know when it's updated? I can try to nudge folks internally. |
The PR is already there, it is google/error-prone#3903 |
(FYI, I locally confirmed that running binaries that reference the errorprone annotations, even reflectively iterating through annotations & annotation of annotations) works just fine if the annotation isn't on the classpath at runtime.) |
Great, thanks for that. |
The annotations are not required by Guice at runtime, see google/guice#1739
The annotations are not required by Guice at runtime, see google/guice#1739
The annotations are not required by Guice at runtime, see google/guice#1739
The annotations are not required by Guice at runtime, see google/guice#1739
At the moment the error_prone_annotations are a mandatory requirement. But annotations with retention policy 'runtime' are ignored if they cannot be loaded at runtime (at least according to Stack-Overvflow). This PR aims to make the dependency optional to not enforce the presence of error_prone_annotations in a java runtime if those annotations are not used at all.
This is especially useful for OSGi-runtimes where you cannot exclude error_prone_annotations because the corresponding package is specified as mandatory requirement in the MANIFEST.MF. Marking the Maven dependency as optional will also result in the error-prone package requirement being marked as optional.
At the moment error_prone_annotations does not come with a OSGi compliant Manifest, which makes it harder to include it in OSGi applications like Eclipse.
I already created a PR at error-prone to include the required OSGi headers (see google/error-prone#3903), but not requiring the annotations at all would make it even simpler to use guice within OSGi.
Alternatively the dependency could only be marked as optional in the OSGi metadata.