You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[sdk-platform-java] api-common using deprecated javax.annotation-api #12487
Google Cloud storage recieved googleapis/java-storage#2176 due to a transient dependency on javax.annotaion-api. This should be updated to the new jakarta namespace.
Hi @suztomo
Please pardon my limited knowledge. As far as I know packages javax.* are not part of Jakarta EE platform and hence are deprecated and will be replaced by jakarta annotations
As an example please refer to below issue. jruby/jruby#6514
@abhishekshan03@MyDogIsMyPersonality Are you suffering from some errors with certain tools when they're used with GCP Java libraries? I think it's easy to swap but I'd like to ensure to verify the fix.
@abhishekshan03@MyDogIsMyPersonality Are you suffering from some errors with certain tools when they're used with GCP Java libraries? I think it's easy to swap but I'd like to ensure to verify the fix.
@suztomo
I shared jruby/jruby#6514 as an example for your to refer. I havent not asked any action to be taken on this issue. javax.annotation-api.jar is deprecated and should be replaced by jakarta annotations. This ticket was to illustrate that other projects are replacing deprecated javax.annotation-api.jar with jarkarta annotations.
Can you please give us an ETA for replacing the dependency for javax.annotation-api.jar with jarkarta annotations in google-cloud-storage.jar ?
Thank you. It's good to hear that there's no one suffering from errors due to the annotations.
we are proactively removing such dependencies
It seems that you're not a normal user of Jakarta EE and Google Cloud. Do you mind sharing who is "we" here (organization name or the name of a team)? Given you're not suffering from this issue, I would like to know the context of why you want this change.
Do you know any changelog to library users when the library swaps javax.annotation-api to Jakarta Annotations (Does it break something?).
Now each has tracking feature request (but no commitment). So far no one has suffered problems caused by javax namespace.
For GuardedBy, (usage), as long as the purpose is Errorprone's static analysis, Errorprone's com.google.errorprone.annotations.concurrent.GuardedBy is recommended one. I'm working on googleapis/sdk-platform-java#2061.
The GuardedBy analysis checks that fields or methods annotated with @GuardedBy(lock) are only accessed when the specified lock is held.
Would removing the synchronized clause fail the build? => Yes, the Bazel build caught a bug I intentionally introduced in googleapis/sdk-platform-java#2060.
changed the title [-]api-common using deprecated javax.annotation-api[/-][+][sdk-platform-java] api-common using deprecated javax.annotation-api[/+]on Apr 1, 2026
Current status on main (9bdd5b8341055d96a1c8d4c249cff0314184cdf6):
sdk-platform-java/api-common-java
pom.xml still declares com.google.code.findbugs:jsr305 (3.0.2) and javax.annotation:javax.annotation-api (1.3.2), with javax.annotation:javax.annotation-api listed in <ignoredUnusedDeclaredDependencies>:
No direct javax.annotation.Generated or javax.annotation.concurrent.GuardedBy usages remain in api-common-java, but javax.annotation.Nullable (from jsr305) is still imported in 4 files:
Activity
suztomo commentedon Aug 31, 2023
Digging further.
Where do we use javax.annotation?
Here are example usages
sdk-platform-java
~/sdk-platform-java$ grep -ir javax.annotation . |awk -F':' '{print $2}' |sort -ugavejavax.annotation.concurrent.GuardedBy(RetentionPolicy.CLASS). This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2javax.annotation.Generated(RetentionPolicy.SOURCE) This comes fromjavax.annotation:javax.annotation-api:jar:1.3.2javax.annotation.Nonnull(RetentionPolicy.RUNTIME) This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2javax.annotation.Nullable(RetentionPolicy.RUNTIME) This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2java-storage
javax.annotation.concurrent.Immutable(RetentionPolicy.CLASS) This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2javax.annotation.concurrent.ThreadSafe(RetentionPolicy.CLASS) This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2javax.annotation.GeneratedSee abovejavax.annotation.NullableSee abovejavax.annotation.ParametersAreNonnullByDefault(RetentionPolicy.RUNTIME) This comes fromcom.google.code.findbugs:jsr305:jar:3.0.2suztomo commentedon Aug 31, 2023
@abhishekshan03 Would you share details about the noncompliance? Do you get any error message when you use certain tools from Jakarta EE?
I found this article https://jakarta.ee/blogs/javax-jakartaee-namespace-ecosystem-progress/ but it didn't have any specifics about
javax.annotation-api.abhishekshan03 commentedon Sep 5, 2023
Hi @suztomo
Please pardon my limited knowledge. As far as I know packages javax.* are not part of Jakarta EE platform and hence are deprecated and will be replaced by jakarta annotations
As an example please refer to below issue.
jruby/jruby#6514
MyDogIsMyPersonality commentedon Sep 18, 2023
Hi @suztomo Is there any idea on when this might be released? It is blocking a major upgrade for us.
suztomo commentedon Sep 18, 2023
@abhishekshan03 @MyDogIsMyPersonality Are you suffering from some errors with certain tools when they're used with GCP Java libraries? I think it's easy to swap but I'd like to ensure to verify the fix.
Thank you for sharing jruby/jruby#6514. I see it's fixed there.
MyDogIsMyPersonality commentedon Sep 18, 2023
There is more information in issue 2176, but Jakarta won't upgrade due to the transient dependency in javax.
suztomo commentedon Sep 18, 2023
@MyDogIsMyPersonality googleapis/java-storage#2176 does not have any errors.
Would you elaborate a bit more? Are you referencing a certain version of one of the tools listed in https://jakarta.ee/compatibility/ ?
abhishekshan03 commentedon Sep 19, 2023
@suztomo
I shared jruby/jruby#6514 as an example for your to refer. I havent not asked any action to be taken on this issue. javax.annotation-api.jar is deprecated and should be replaced by jakarta annotations. This ticket was to illustrate that other projects are replacing deprecated javax.annotation-api.jar with jarkarta annotations.
Can you please give us an ETA for replacing the dependency for javax.annotation-api.jar with jarkarta annotations in google-cloud-storage.jar ?
abhishekshan03 commentedon Sep 19, 2023
We are not facing any error but since there is dependency on the deprecated javax.annotation-api.jar, we are proactively removing such dependencies.
suztomo commentedon Sep 19, 2023
Thank you. It's good to hear that there's no one suffering from errors due to the annotations.
It seems that you're not a normal user of Jakarta EE and Google Cloud. Do you mind sharing who is "we" here (organization name or the name of a team)? Given you're not suffering from this issue, I would like to know the context of why you want this change.
suztomo commentedon Sep 20, 2023
Got information from the TAM. Thank you. I'll update you about the plan soon. We have the email thread to follow up.
suztomo commentedon Sep 26, 2023
Continuing investigation.
suztomo commentedon Sep 27, 2023
We use code generators in Cloud SDK for Java, and they use
javax.annotation.Generated:Now each has tracking feature request (but no commitment). So far no one has suffered problems caused by javax namespace.
For GuardedBy, (usage), as long as the purpose is Errorprone's static analysis, Errorprone's
com.google.errorprone.annotations.concurrent.GuardedByis recommended one. I'm working on googleapis/sdk-platform-java#2061.GuardedBy
https://github.com/google/error-prone/blob/master/docs/bugpattern/GuardedBy.md
Would removing the
synchronizedclause fail the build? => Yes, the Bazel build caught a bug I intentionally introduced in googleapis/sdk-platform-java#2060.[-]api-common using deprecated javax.annotation-api[/-][+][sdk-platform-java] api-common using deprecated javax.annotation-api[/+]suztomo commentedon Nov 17, 2026
Current status on
main(9bdd5b8341055d96a1c8d4c249cff0314184cdf6):sdk-platform-java/api-common-javapom.xmlstill declarescom.google.code.findbugs:jsr305(3.0.2) andjavax.annotation:javax.annotation-api(1.3.2), withjavax.annotation:javax.annotation-apilisted in<ignoredUnusedDeclaredDependencies>:google-cloud-java/sdk-platform-java/api-common-java/pom.xml
Lines 54 to 62 in 9bdd5b8
google-cloud-java/sdk-platform-java/api-common-java/pom.xml
Lines 131 to 134 in 9bdd5b8
javax.annotation.Generatedorjavax.annotation.concurrent.GuardedByusages remain inapi-common-java, butjavax.annotation.Nullable(fromjsr305) is still imported in 4 files:google-cloud-java/sdk-platform-java/api-common-java/src/main/java/com/google/api/core/AbstractApiFuture.java
Line 38 in 9bdd5b8
google-cloud-java/sdk-platform-java/api-common-java/src/main/java/com/google/api/core/ApiFutures.java
Line 42 in 9bdd5b8
google-cloud-java/sdk-platform-java/api-common-java/src/main/java/com/google/api/pathtemplate/PathTemplate.java
Line 50 in 9bdd5b8
google-cloud-java/sdk-platform-java/api-common-java/src/main/java/com/google/api/pathtemplate/TemplatedResourceName.java
Line 40 in 9bdd5b8
Related progress
google-auth-library-javaexcludedjavax.annotation:javax.annotation-apifrom itsapi-commondependency in fix(auth): exclude javax.annotation-api from api-common dependency #14538.gax-javamigrated offjsr305to JSpecify in cleanup(gax-java): remove javax.annotation.Nonnull usage #13959 and fix(gax): drop jsr305 annotations left over after syncing with main #14626.Unassigning myself as I am no longer working on this issue.