Repository navigation
feat(annotations): make @SimpleBuilderFor repeatable - #322
Merged
AndreasIgel merged 1 commit intoOct 3, 2026
Merged
AndreasIgel merged 1 commit into
AndreasIgel merged 1 commit into
Conversation
Repeatable declarations on the same holder (class or package-info) let each listing carry its own options - e.g. a different packageName per declaration. Adds the SimpleBuilderFors container, a generic findAnnotationInstances lookup in JavaLangAnalyser, and per-instance target/config resolution in BuilderProcessor. Relates to java-helpers#296 Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



Issues: follow-up to #296 and #293
Summary
Makes
@SimpleBuilderFor@Repeatable: several declarations may be placed on the same holder class orpackage-info.java, each carrying its ownvaluelist andoptions. This lets one holder route different types into different generated packages:Implementation
SimpleBuilderFors— the container annotation javac wraps repeated declarations in (same{TYPE, PACKAGE}target,CLASSretention).JavaLangAnalyser.findAnnotationInstances— generic repeatable-annotation lookup: direct mirrors plus entries unwrapped from the container, in declaration order.BuilderProcessor— collects holders annotated with either the annotation or its container, then resolvesvalueandoptionsper instance, so each declaration gets its ownpackageName/builderSuffix/etc. Duplicate targets across declarations still hit the existing "already generated elsewhere" skip.BuilderConfigurationReader.resolveHolderConfiguration— now takes the specific annotation instance instead of re-finding one on the element.Tests
repeatable_GeneratesBuildersIntoDifferentPackages— two declarations with differentpackageNameon one holderrepeatable_OnPackageInfo_GeneratesBuildersIntoAnnotatedPackage— repeated declarations inpackage-info.javarepeatable_DuplicateType_SecondDeclarationSkippedWithWarning— same type listed twice499 processor tests + example regeneration check green locally.
Documentation
@SimpleBuilderFordocuments the repeatable usagedocs/CONFIGURATION.md: repeatable example in the "Generating Builders for External Types" sectionWritten by Devin