#1519 Avoid unused delegate field in decorators - #4099
Open
kalayciburak wants to merge 1 commit into
Open
Conversation
kalayciburak
force-pushed
the
fix/1519-unused-delegate-field
branch
from
July 19, 2026 17:42
fadcc4f to
228a68f
Compare
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.
Fixes #1519.
This avoids generating the private
delegatefield and its constructor assignment when the decorator implements all mapper methods itself.Constructor generation now handles both decorator shapes:
super(delegate).The change also avoids retaining unused mapper imports for custom implementation packages, including nested decorators, while preserving imports required by generated annotations.
Regression coverage runs with both javac and Eclipse compilers and covers delegate-constructor and default-constructor decorators. Existing partial-decorator, Spring, JSR-330/Jakarta, cross-package, and destination-package suites remain green.
Tests:
verify: 13 test classes, including Spring constructor/setter/field, JSR-330/Jakarta, cross-package, destination-package, and issues Very minor suggestion: don't generate private delegate field if it's not used #1519/Wrong decorator class name used when Decorator class is nested inside mapper interface #2021forbiddenapis: 661 classes, 0 errors