fix: AnnotationEnhancer chain silently discards all modifications - #775
fix: AnnotationEnhancer chain silently discards all modifications#775lossend wants to merge 1 commit into
Conversation
…chain The buildEnhancer lambda was accumulating enhanced attributes into newAttrs across all AnnotationEnhancer beans, but then returned the original attrs — making all enhancers silently no-op. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR Review for #775: fix: AnnotationEnhancer chain silently discards all modificationsSummaryThis PR modifies 1 file(s) with +1/-1 lines changed. Changed Files
Observations
Next StepsA detailed code-level review requires the code engine. This is a structural overview only. |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Clear bug fix: the buildEnhancer() lambda was returning the original attrs instead of the enhanced newAttrs, silently discarding all AnnotationEnhancer modifications. One-line fix that corrects the return value.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This is a clear one-line bug fix: the AnnotationEnhancer chain lambda accumulates modifications into newAttrs but then returns the original attrs, silently discarding all enhancer modifications.
Analysis:
- The bug is in
buildEnhancer()at line 183:return attrs;should bereturn newAttrs; - The fix is correct and minimal — exactly one line changed
- No side effects:
newAttrsis initialized fromattrsand only modified by the enhancer chain - This is a real bug that makes
AnnotationEnhancerbeans completely non-functional
LGTM. Good catch on a subtle but impactful bug.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Critical bug fix — the AnnotationEnhancer chain was silently discarding all modifications. The loop correctly applies each enhancer to newAttrs, but then returns the original attrs instead of the modified newAttrs. This one-line fix ensures the accumulated enhancements are actually returned.
This is a clear correctness bug: any custom AnnotationEnhancer implementations would have had zero effect at runtime. Well spotted.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Critical bug fix. The AnnotationEnhancer chain was silently discarding all modifications because the code returned the original attrs instead of the accumulated newAttrs after applying all enhancers. This one-line fix corrects the return value.
Findings
- [Critical] Without this fix, all annotation enhancements are lost. This could cause subtle bugs where custom annotation attributes (e.g., custom consumer/producer configurations) are ignored.
Suggestions
The fix is correct and minimal. Consider adding a unit test that verifies the enhancer chain actually modifies the annotation attributes, to prevent regression.
Automated review by github-manager-bot
Fixes #776
Problem
In
RocketMQMessageListenerBeanPostProcessor.buildEnhancer(), the lambda accumulatesenhanced annotation attributes into
newAttrsacross all registeredAnnotationEnhancerbeans, but then returns the original
attrsinstead ofnewAttrs.This means every
AnnotationEnhancerbean is silently a no-op — its attributemodifications are computed but thrown away.
Fix
Return
newAttrsinstead ofattrs.Root Cause
buildEnhancer()(line 178–184):Impact
Any application that relies on
AnnotationEnhancerto dynamically override@RocketMQMessageListenerattributes (e.g. injecting topic/group from environment properties) will find their customizations have no effect.