From f4a66b797ecc05d80406d6c8fb11e6cc0e5c6d21 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Fri, 12 May 2023 09:47:35 -0700 Subject: [PATCH] Make error_prone_annotations dependency optional Annotations with retention policy are ignored if they cannot be loaded at runtime (at least according to [Stack-Overvflow](https://stackoverflow.com/questions/3567413/why-doesnt-a-missing-annotation-cause-a-classnotfoundexception-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. 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 https://github.com/google/error-prone/pull/3903), but not requiring the annotations at all would make it even simpler to use guice within OSGi. Alternatively the dependency could be marked as optional in the OSGi metadata. Fixes #1739 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/guice/pull/1739 from HannesWell:optionalErrorproneAnnotations 86f9de0e50ec1cba8217a74895f4b6ca56246dff PiperOrigin-RevId: 531531783 --- core/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/pom.xml b/core/pom.xml index 2b295101be..047c2b78d0 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -29,6 +29,7 @@ com.google.errorprone error_prone_annotations + true