Begin migration to Jakarta Annotations #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Core ships the Java EE annotation API, which is consumed both in core itself and in Stapler (a core dependency). Specifically, we consume
javax.annotation.PostConstruct
.configuration-as-code
,coverity
,datetime-constraint
,opentelemetry
, andstrict-crumb-issuer
consumejavax.annotation.PostConstruct
from core.coverity
,jira
, andopentelemetry
consumejavax.annotation.PreDestroy
from core.gitlab-plugin
consumesjavax.annotation.Priority
from core. All of these are subject to Jakarta package renames. This means we need to come up with a migration plan.Solution
This PR begins a migration by shipping both the old
javax.annotation
classes and the newjakarta.annotation
classes, adjusting Stapler to check bothjakarta.annotation.PostConstruct
andjavax.annotation.PostConstruct
for backward compatibility. Stapler itself is migrated tojakarta.annotation
, and when this PR is merged and released and core upgrades to it, then core can also switch tojakarta.annotation
. This just leaves the plugins mentioned above. As each plugin upgrades its core baseline to one that includes a Stapler release with this PR, the plugin can migrate fromjavax.annotation
tojakarta.annotation
. Once each of the above plugins has done so and the PRs have been merged and released,usage-in-plugins
should show no usages forjavax.annotation
in the ecosystem. At that point, thejavax.annotation:javax.annotation-api
dependency can be removed and the migration will be considered complete.