Skip to content

Conversation

JooHyukKim
Copy link
Member

@JooHyukKim JooHyukKim commented Jul 4, 2025

Fixes #5215 (caused by #4775)

Comment on lines 507 to 524
private Map<String, POJOPropertyBuilder> _putAnyGettersInTheEnd(Map<String, POJOPropertyBuilder> all, Map<String, POJOPropertyBuilder> props) {
for (POJOPropertyBuilder prop : props.values()) {
all.put(prop.getName(), prop);
}
Map<String, POJOPropertyBuilder> newAll = new LinkedHashMap<String,POJOPropertyBuilder>(props.size()+props.size());
POJOPropertyBuilder anyGetterProp = null;
for (POJOPropertyBuilder prop : all.values()) {
if (prop.getAccessor() != null && Boolean.TRUE.equals(this._config.getAnnotationIntrospector().hasAnyGetter(prop.getAccessor()))) {
anyGetterProp = prop;
} else {
newAll.put(prop.getName(), prop);
}
}
if (anyGetterProp != null) {
newAll.put(anyGetterProp.getName(), anyGetterProp);
}
return newAll;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This puts anyGetter prop in the end by default, before we go sorting downstream in _sortProperties

}

@Test
// @Test
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure this out first.

@JooHyukKim JooHyukKim changed the base branch from 2.x to 2.19 July 4, 2025 16:44
Map<String, POJOPropertyBuilder> newAll = new LinkedHashMap<String,POJOPropertyBuilder>(props.size()+props.size());
POJOPropertyBuilder anyGetterProp = null;
for (POJOPropertyBuilder prop : all.values()) {
if (prop.getAccessor() != null && Boolean.TRUE.equals(this._config.getAnnotationIntrospector().hasAnyGetter(prop.getAccessor()))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we really should not do annotation introspector here, again...

@JooHyukKim
Copy link
Member Author

Oh wow, thank you for the extra work @cowtowncoder 👍👍 almost seems like a brand new PR

@cowtowncoder
Copy link
Member

Oh wow, thank you for the extra work @cowtowncoder 👍👍 almost seems like a brand new PR

Np. I got bit carried away. But the logic remains the way it was so it's still your PR :)

Will now merge.

Copy link
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cowtowncoder cowtowncoder merged commit ea940e5 into FasterXML:2.19 Jul 9, 2025
8 checks 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.

2 participants