Skip to content

Commit 6a50a63

Browse files
committed
Replace javax.annotation-api with Tomcat's annotations-api
javax.annotation-api is licensed CDDL, which was not noticed when it was introduced. Tomcat provides an Apache 2 version of the same annotation. Note that this annotation is only used when compiling with Java 9+. Unfortunately this may cause classpath collisions since there are _many_ copies of this annotation on Maven Central; we wanted one canonical source and javax.annotation-api seemed like that source. We hope this won't impact many users since we have always suggested using it only for compilation. But it will probably impact some users. However, we didn't create this mess, this seems to be "standard practice" for J2EE, which this annotation is now part of, so we're just impacted by it. Fixes #6833
1 parent e78d1c9 commit 6a50a63

File tree

19 files changed

+40
-41
lines changed

19 files changed

+40
-41
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ subprojects {
138138
gson: "com.google.code.gson:gson:2.8.6",
139139
guava: "com.google.guava:guava:${guavaVersion}",
140140
hpack: 'com.twitter:hpack:0.10.1',
141-
javax_annotation: 'javax.annotation:javax.annotation-api:1.2',
141+
javax_annotation: 'org.apache.tomcat:annotations-api:6.0.53',
142142
jsr305: 'com.google.code.findbugs:jsr305:3.0.2',
143143
google_api_protos: 'com.google.api.grpc:proto-google-common-protos:1.17.0',
144144
google_auth_credentials: "com.google.auth:google-auth-library-credentials:${googleauthVersion}",

examples/android/clientcache/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies {
5353
implementation 'io.grpc:grpc-okhttp:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5454
implementation 'io.grpc:grpc-protobuf-lite:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5555
implementation 'io.grpc:grpc-stub:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
56-
implementation 'javax.annotation:javax.annotation-api:1.2'
56+
implementation 'org.apache.tomcat:annotations-api:6.0.53'
5757

5858
testImplementation 'junit:junit:4.12'
5959
testImplementation 'com.google.truth:truth:1.0.1'

examples/android/helloworld/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ dependencies {
5252
implementation 'io.grpc:grpc-okhttp:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5353
implementation 'io.grpc:grpc-protobuf-lite:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5454
implementation 'io.grpc:grpc-stub:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
55-
implementation 'javax.annotation:javax.annotation-api:1.2'
55+
implementation 'org.apache.tomcat:annotations-api:6.0.53'
5656
}

examples/android/routeguide/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ dependencies {
5151
implementation 'io.grpc:grpc-okhttp:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5252
implementation 'io.grpc:grpc-protobuf-lite:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5353
implementation 'io.grpc:grpc-stub:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
54-
implementation 'javax.annotation:javax.annotation-api:1.2'
54+
implementation 'org.apache.tomcat:annotations-api:6.0.53'
5555
}

examples/android/strictmode/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ dependencies {
5252
implementation 'io.grpc:grpc-okhttp:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5353
implementation 'io.grpc:grpc-protobuf-lite:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5454
implementation 'io.grpc:grpc-stub:1.30.0-SNAPSHOT' // CURRENT_GRPC_VERSION
55-
implementation 'javax.annotation:javax.annotation-api:1.2'
55+
implementation 'org.apache.tomcat:annotations-api:6.0.53'
5656
}

examples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def protocVersion = protobufVersion
2929
dependencies {
3030
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
3131
implementation "io.grpc:grpc-stub:${grpcVersion}"
32-
compileOnly "javax.annotation:javax.annotation-api:1.2"
32+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3333

3434
// examples/advanced need this for JsonFormat
3535
implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}"

examples/example-alts/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def protocVersion = '3.11.0'
2929
dependencies {
3030
// grpc-alts transitively depends on grpc-netty-shaded, grpc-protobuf, and grpc-stub
3131
implementation "io.grpc:grpc-alts:${grpcVersion}"
32-
compileOnly "javax.annotation:javax.annotation-api:1.2"
32+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3333
}
3434

3535
protobuf {

examples/example-gauth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
3333
implementation "io.grpc:grpc-stub:${grpcVersion}"
3434
implementation "io.grpc:grpc-auth:${grpcVersion}"
35-
compileOnly "javax.annotation:javax.annotation-api:1.2"
35+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3636
implementation "com.google.auth:google-auth-library-oauth2-http:0.9.0"
3737
implementation "com.google.api.grpc:grpc-google-cloud-pubsub-v1:0.1.24"
3838
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"

examples/example-gauth/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
<artifactId>grpc-auth</artifactId>
5151
</dependency>
5252
<dependency>
53-
<groupId>javax.annotation</groupId>
54-
<artifactId>javax.annotation-api</artifactId>
55-
<version>1.2</version>
53+
<groupId>org.apache.tomcat</groupId>
54+
<artifactId>annotations-api</artifactId>
55+
<version>6.0.53</version>
5656
<scope>provided</scope> <!-- not needed at runtime -->
5757
</dependency>
5858
<dependency>

examples/example-hostname/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies {
2727
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
2828
implementation "io.grpc:grpc-stub:${grpcVersion}"
2929
implementation "io.grpc:grpc-services:${grpcVersion}"
30-
compileOnly "javax.annotation:javax.annotation-api:1.2"
30+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3131
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
3232

3333
testImplementation 'junit:junit:4.12'

examples/example-hostname/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
<artifactId>grpc-services</artifactId>
4646
</dependency>
4747
<dependency>
48-
<groupId>javax.annotation</groupId>
49-
<artifactId>javax.annotation-api</artifactId>
50-
<version>1.2</version>
48+
<groupId>org.apache.tomcat</groupId>
49+
<artifactId>annotations-api</artifactId>
50+
<version>6.0.53</version>
5151
<scope>provided</scope> <!-- not needed at runtime -->
5252
</dependency>
5353
<dependency>

examples/example-jwt-auth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
implementation "io.jsonwebtoken:jjwt:0.9.1"
3333
implementation "javax.xml.bind:jaxb-api:2.3.1"
3434

35-
compileOnly "javax.annotation:javax.annotation-api:1.2"
35+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3636

3737
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
3838

examples/example-jwt-auth/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
<version>2.3.1</version>
5959
</dependency>
6060
<dependency>
61-
<groupId>javax.annotation</groupId>
62-
<artifactId>javax.annotation-api</artifactId>
63-
<version>1.2</version>
61+
<groupId>org.apache.tomcat</groupId>
62+
<artifactId>annotations-api</artifactId>
63+
<version>6.0.53</version>
6464
<scope>provided</scope> <!-- not needed at runtime -->
6565
</dependency>
6666
<dependency>

examples/example-tls/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131
implementation "io.grpc:grpc-netty:${grpcVersion}"
3232
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
3333
implementation "io.grpc:grpc-stub:${grpcVersion}"
34-
compileOnly "javax.annotation:javax.annotation-api:1.2"
34+
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3535
runtimeOnly "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
3636
}
3737

examples/example-tls/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
<artifactId>grpc-stub</artifactId>
4343
</dependency>
4444
<dependency>
45-
<groupId>javax.annotation</groupId>
46-
<artifactId>javax.annotation-api</artifactId>
47-
<version>1.2</version>
45+
<groupId>org.apache.tomcat</groupId>
46+
<artifactId>annotations-api</artifactId>
47+
<version>6.0.53</version>
4848
<scope>provided</scope> <!-- not needed at runtime -->
4949
</dependency>
5050
<dependency>

examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
<artifactId>grpc-stub</artifactId>
4848
</dependency>
4949
<dependency>
50-
<groupId>javax.annotation</groupId>
51-
<artifactId>javax.annotation-api</artifactId>
52-
<version>1.2</version>
50+
<groupId>org.apache.tomcat</groupId>
51+
<artifactId>annotations-api</artifactId>
52+
<version>6.0.53</version>
5353
<scope>provided</scope> <!-- not needed at runtime -->
5454
</dependency>
5555
<dependency>

repositories.bzl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
3939
"io.opencensus:opencensus-api:0.24.0",
4040
"io.opencensus:opencensus-contrib-grpc-metrics:0.24.0",
4141
"io.perfmark:perfmark-api:0.19.0",
42-
"javax.annotation:javax.annotation-api:1.2",
4342
"junit:junit:4.12",
4443
"org.apache.commons:commons-lang3:3.5",
44+
"org.apache.tomcat:annotations-api:6.0.53",
4545
"org.codehaus.mojo:animal-sniffer-annotations:1.18",
4646
]
4747

@@ -148,12 +148,12 @@ def grpc_java_repositories():
148148
io_opencensus_opencensus_contrib_grpc_metrics()
149149
if not native.existing_rule("io_perfmark_perfmark_api"):
150150
io_perfmark_perfmark_api()
151-
if not native.existing_rule("javax_annotation_javax_annotation_api"):
152-
javax_annotation_javax_annotation_api()
153151
if not native.existing_rule("junit_junit"):
154152
junit_junit()
155153
if not native.existing_rule("org_apache_commons_commons_lang3"):
156154
org_apache_commons_commons_lang3()
155+
if not native.existing_rule("org_apache_tomcat_annotations_api"):
156+
org_apache_tomcat_annotations_api()
157157
if not native.existing_rule("org_codehaus_mojo_animal_sniffer_annotations"):
158158
org_codehaus_mojo_animal_sniffer_annotations()
159159

@@ -451,16 +451,6 @@ def io_perfmark_perfmark_api():
451451
licenses = ["notice"], # Apache 2.0
452452
)
453453

454-
def javax_annotation_javax_annotation_api():
455-
# Use //stub:javax_annotation for neverlink=1 support.
456-
jvm_maven_import_external(
457-
name = "javax_annotation_javax_annotation_api",
458-
artifact = "javax.annotation:javax.annotation-api:1.2",
459-
server_urls = ["https://repo.maven.apache.org/maven2/"],
460-
artifact_sha256 = "5909b396ca3a2be10d0eea32c74ef78d816e1b4ead21de1d78de1f890d033e04",
461-
licenses = ["reciprocal"], # CDDL License
462-
)
463-
464454
def junit_junit():
465455
jvm_maven_import_external(
466456
name = "junit_junit",
@@ -479,6 +469,16 @@ def org_apache_commons_commons_lang3():
479469
licenses = ["notice"], # Apache 2.0
480470
)
481471

472+
def org_apache_tomcat_annotations_api():
473+
# Use //stub:javax_annotation for neverlink=1 support.
474+
jvm_maven_import_external(
475+
name = "org_apache_tomcat_annotations_api",
476+
artifact = "org.apache.tomcat:annotations-api:6.0.53",
477+
server_urls = ["https://repo.maven.apache.org/maven2/"],
478+
artifact_sha256 = "253829d3c12b7381d1044fc22c6436cff025fe0d459e4a329413e560a7d0dd13",
479+
licenses = ["notice"], # Apache 2.0
480+
)
481+
482482
def org_codehaus_mojo_animal_sniffer_annotations():
483483
jvm_maven_import_external(
484484
name = "org_codehaus_mojo_animal_sniffer_annotations",

services/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ java_library(
6060
"@com_google_protobuf//:protobuf_java",
6161
"@com_google_protobuf//:protobuf_java_util",
6262
"@io_grpc_grpc_proto//:reflection_java_proto_deprecated",
63-
"@javax_annotation_javax_annotation_api//jar",
6463
],
6564
)
6665

stub/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ java_library(
1919
name = "javax_annotation",
2020
neverlink = 1, # @Generated is source-retention
2121
visibility = ["//visibility:public"],
22-
exports = ["@javax_annotation_javax_annotation_api//jar"],
22+
exports = ["@org_apache_tomcat_annotations_api//jar"],
2323
)

0 commit comments

Comments
 (0)