Enforce import style: auto-shorten FQCNs via OpenRewrite in CI#22935
Draft
gnodet wants to merge 7 commits intoapache:mainfrom
Draft
Enforce import style: auto-shorten FQCNs via OpenRewrite in CI#22935gnodet wants to merge 7 commits intoapache:mainfrom
gnodet wants to merge 7 commits intoapache:mainfrom
Conversation
…enRewrite Add rewrite-maven-plugin with ShortenFullyQualifiedTypeReferences recipe to automatically replace unnecessary FQCNs with simple class names and add the corresponding import statements. Generated code (src/generated/) is excluded from processing. The plugin is gated behind a -Prewrite Maven profile so it only runs in CI regen builds, not during local development. Both PR and main build workflows now pass -Prewrite to regen.sh, and the existing "fail if uncommitted changes" step catches any FQCN fixes that were not committed by the PR author. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
approved these changes
May 5, 2026
Contributor
|
ℹ️ CI did not run targeted module tests (root project files changed). |
apupier
reviewed
May 5, 2026
Contributor
apupier
left a comment
There was a problem hiding this comment.
Why is it not applied during normal build like for other formatting?
Auto-fix generated by OpenRewrite ShortenFullyQualifiedTypeReferences recipe across 598 files in 187 modules. Replaces inline fully qualified class names with simple names and adds the corresponding import statements where no import clash exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
It takes a bit of time. The PR workflow is fine because it usually does not rebuild everything. But we can apply it globally if we want. |
apupier
requested changes
May 5, 2026
Comment on lines
34
to
35
| import org.apache.camel.diagram.RouteDiagramLayoutEngine.TreeNode; | ||
|
|
Contributor
There was a problem hiding this comment.
missing import for jline Colors
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
LGTM |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
rewrite-maven-pluginwithShortenFullyQualifiedTypeReferencesrecipe to automatically replace unnecessary fully qualified class names with simple names + imports-PrewriteMaven profile — only runs in CI, not during local buildsrunNoForkgoal withrunPerSubmodule=trueto process each module immediately during the buildsrc/generated/) is excluded from processing-Prewritetoregen.sh, and the existing "fail if uncommitted changes" step catches any unfixed FQCNsCLAUDE.mdwith import style conventions for AI agentsHow it works
regen.shwith-Prewrite→ OpenRewrite shortens unnecessary FQCNs and adds importsimpsortsorts the new imports (already runs in the same build)formatterformats the code (already runs in the same build)git status --porcelainstep fails if any files were modifiedLocal developers can opt-in with
mvn install -Prewriteto auto-fix FQCNs before pushing.Test plan
mvn install) does not run OpenRewrite-Prewriteruns OpenRewrite and shortens FQCNs per modulesrc/generated/) are excludedgit status --porcelain