Skip to content

fix: prioritize subclass fields and ignore superclass annotations on field shadowing - #1007

Open
bengbengbalabalabeng wants to merge 2 commits into
apache:mainfrom
bengbengbalabalabeng:fix-field-handle-priority
Open

fix: prioritize subclass fields and ignore superclass annotations on field shadowing#1007
bengbengbalabalabeng wants to merge 2 commits into
apache:mainfrom
bengbengbalabalabeng:fix-field-handle-priority

Conversation

@bengbengbalabalabeng

Copy link
Copy Markdown
Contributor

Purpose of the pull request

Similar to #427

Fix the issue where a subclass attribute with the same name (field shadowing) in a class inheritance chain mistakenly inherits the parent class annotation (such as @DateTimeFormat), causing abnormal sheet export formatting.

Special thanks to @nkuprins for identifying this issue in Discussion #919 !

What's changed?

Refactored the field collection logic in ClassUtils#doDeclaredFieldContentMap and extracted it into a reusable FieldUtils#resolveFields utility method.

Scope of affected annotations:

  • @ContentStyle
  • @ContentFontStyle
  • @ExcelProperty (converter attribute)
  • @DateTimeFormat
  • @NumberFormat

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant