Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Jakarta EE 9.1 changed the package namespace from javax to jakarta. This migration enables compatibility with modern frameworks like Quarkus and Helidon that require the jakarta namespace.

Changes

Source files

  • Replaced all javax.annotation.* imports and fully-qualified annotations with jakarta.annotation.* across:
    • util module (@Nullable, @Nonnull)
    • spring module (@Resource)
    • client-java-contrib/prometheus-operator (@Generated, @Nullable)
    • client-java-contrib/admissionreview (@Nullable)

Dependencies

  • Removed javax.annotation-api from dependency management and all module poms
  • Added jakarta.annotation-api where needed (util, prometheus-operator)
  • Existing jakarta dependency in kubernetes/pom.xml now serves as sole annotation source

Pre-merge validation

Added Spotless rule to prevent reintroduction of javax.annotation:

<replaceRegex>
  <name>Forbids javax.annotation imports</name>
  <searchRegex>^import (static )?javax\.annotation\..*;$</searchRegex>
  <replacement>INVALID IMPORTS (JAVAX.ANNOTATION) - use jakarta.annotation instead</replacement>
</replaceRegex>

Builds will fail if any javax.annotation imports are introduced.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • groovy.jfrog.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -classpath /home/REDACTED/work/java/java/.mvn/wrapper/maven-wrapper.jar -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/java/java org.apache.maven.wrapper.MavenWrapperMain spotless:check -pl util grep -l javax\.annotation erBehavior.java rceFieldRef.java -l dels/V1StorageClassListFluent.java rSpecSelfSigned.java grep /io/kubernetes/client/spring/extended/controller/KubernetesInformerCreatorTest.java dels/V1ResourceClaimTemplateListFluent.java /home/REDACTED/work/java/java/kubegrep (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -classpath /home/REDACTED/work/java/java/.mvn/wrapper/maven-wrapper.jar -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/java/java org.apache.maven.wrapper.MavenWrapperMain spotless:apply -pl util -Dgroovy.skip=true -q javax\.annotation va grep -l dels/V1ValidatingAdmissionPolicyListFluent.java /home/REDACTED/work/java/java/fluegrep grep /io/kubernetes/client/spring/extended/manifests/KubernetesManifestTest.java gnoredDuringExecutionInnerPodAffinityTermNamespaceSelector.java rReferenceBuilder.java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Question: any plans to migrating from javax to jakarta package namespaces?</issue_title>
<issue_description>In Jakarta EE 9.1 APIs package namespace was changed from javax to jakarta. Jakarta EE 9.1 is supported by many popular frameworks like Quarkus, Helidon, etc.

Here are some links talking about this namespace change:

Are there any plans for such a migration in the k8s client?</issue_description>

<agent_instructions>In addition to migrating all references to javax.annotation to use Jakarta.annotation, please add a pre-merge validator which prevents us from adding any new references to javax.annotation. This should be possible by adding a custom style rule in our pom.xml</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@brendandburns I think it would be fine to migrate the `javax.annotation.*` to `jakarta.annotation.*` The other javax references are for SSL and I don't believe that is present in the jakarta namespace (nor do I necessarily want to switch ssl implementations)

But we'd definitely take a PR to update all of the annotations if you wanted to send it.</comment_new>
<comment_new>@brendandburns
Some reference/background reading:

https://www.infoworld.com/article/3600158/enterprise-java-gets-a-new-namespace.html</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 3, 2025
- Update all Java source files to use jakarta.annotation instead of javax.annotation
- Remove javax.annotation-api dependency from all pom.xml files
- Add jakarta.annotation-api dependency where needed
- Add Spotless rule to forbid new javax.annotation imports
- Remove javax.annotation.version property from parent pom.xml

Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 3, 2025
Copilot AI changed the title [WIP] Migrate from javax to jakarta package namespaces Migrate from javax.annotation to jakarta.annotation namespace Dec 3, 2025
Copilot AI requested a review from brendandburns December 3, 2025 02:14
Copilot finished work on behalf of brendandburns December 3, 2025 02:14
@brendandburns brendandburns removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2025
Copy link
Contributor

@brendandburns brendandburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 3, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, Copilot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2025
@brendandburns brendandburns marked this pull request as ready for review December 4, 2025 04:23
@k8s-ci-robot k8s-ci-robot merged commit 4f8d7fd into master Dec 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: any plans to migrating from javax to jakarta package namespaces?

3 participants