Skip to content

Resolve nested bean properties with generic context - #37276

Open
dlwhdgus0810 wants to merge 1 commit into
spring-projects:mainfrom
dlwhdgus0810:fix-nested-generic-enum-binding
Open

dlwhdgus0810 wants to merge 1 commit into
spring-projects:mainfrom
dlwhdgus0810:fix-nested-generic-enum-binding

Conversation

@dlwhdgus0810

Copy link
Copy Markdown

Closes gh-27760.

Nested properties such as Filter<State>.value lose their declared enum type when binding moves into the Filter instance. Binding then stores a String or fails against the raw Enum bound.

Preserve the enclosing property's generic context in nested bean wrappers and use it for property and container conversion. Keep more specific runtime-class types and keep contextual descriptors separate from shared introspection metadata. No public API is added.

Validation (JDK 25):

  • The 12 new regression/control cases produce 10 failures on unmodified upstream and all pass with the fix.
  • Full spring-beans suite: 2,306 tests, no failures, 9 existing skips.
  • DataBinderTests: 81 tests, no failures.
  • spring-beans Checkstyle checks pass.

Coverage includes bounded and unbounded enum parameters, nested beans, list/map entries, optional values, arrays, distinct generic declarations, conversion services and runtime subclasses.

Retain the declaring property type when creating nested bean wrappers,
and use its generic context for property and container conversions.
Preserve more specific types supplied by concrete runtime classes.

Closes spring-projectsgh-27760

Signed-off-by: Hyun Lee <dlwhdugs4147@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolving generic enum types (Enum<T>) in nested bean properties

2 participants