Skip to content

#3928 Select JAXB factory method when field name differs in case from property - #4152

Open
b84330808 wants to merge 1 commit into
mapstruct:mainfrom
b84330808:fix-jaxb-factory-selection-case
Open

b84330808 wants to merge 1 commit into
mapstruct:mainfrom
b84330808:fix-jaxb-factory-selection-case

Conversation

@b84330808

Copy link
Copy Markdown

Fixes #3928

As the comment on the issue says, the dash isn't the real problem. For an element like XY-Something, xjc and cxf generate the field xySomething with getXYSomething/setXYSomething, so the property is XYSomething. XmlElementDeclSelector looks for a field with exactly the property name to read its @XmlElementRef name, doesn't find it, and is left with every ObjectFactory method of that scope, which ends in "Ambiguous mapping methods found".

It now falls back to a field that differs only in case. An exact match still wins. The test covers two elements of the same scope.

…case from property

XmlElementDeclSelector looks up the field with the name of the target property
to read its @XmlElementRef name. For an element like XY-Something, xjc and cxf
generate the field xySomething and the accessors getXYSomething/setXYSomething,
so the property is XYSomething. The field was not found, nothing matched on
name, and every ObjectFactory method with the same scope was left, which
failed with "Ambiguous mapping methods found".

Fall back to a field that only differs in case. An exact match still wins.
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.

JAXB ObjectFactory Mapping with Dash (-)

1 participant