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.
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.