Skip to content

Conversation

@JacksonJang
Copy link
Contributor

I resolved #5433

SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);

int ix = _propNameMatcher.matchName(propName);
SettableBeanProperty regularProp = (ix >= 0) ? _propsByIndex[ix] : null;
Copy link
Member

Choose a reason for hiding this comment

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

Ok so my problem here is the double lookups in every case, even if in most cases single lookup (for CreatorProperty) should be necessary.
Now, in theory, _propNameMatcher lookup should be enough (matcher should be superset of ALL SettableBeanProperty entries, and type of property could be checked separately, as needed.

I am trying concurrent changes to do that, but having some problems. Alternatively this PR could be refactored to limit need for extra lookups I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the answer :)
I’ll review that part of the code as well and try refactoring it.
Once I make the improvements, I’ll update the PR.

@cowtowncoder
Copy link
Member

@JacksonJang Can we actually reproduce the issue with plain Java? It'd be very useful to have test here instead of requiring Kotlin module's test.

@JacksonJang
Copy link
Contributor Author

Okay.
I’ll work on creating a plain Java test case that reproduces the issue.

@cowtowncoder
Copy link
Member

One thing I noticed is that in Java @JsonIgnore cannot be added to constructor parameter, so need to probably use a custom AnnotationIntrospector to fake it (not sure if/why/how Kotlin allows).
Or alternatively maybe @JsonIgnore is only added on backing Field, then, in Kotlin class.

@cowtowncoder
Copy link
Member

@JacksonJang See #5457 which I think is reproduction.

@cowtowncoder
Copy link
Member

Ok: I think the ideal solution would actually be to handle "split" property case in POJOPropertiesCollector... and not in BeanDeserializer. In this case ignoral of Field should not lead to ignoral of (setter) Method.

@JacksonJang
Copy link
Contributor Author

JacksonJang commented Dec 2, 2025

Thank you for writing the test case.
I’ll use this case and later update the logic to handle it on the POJOPropertiesCollector side.

@cowtowncoder
Copy link
Member

@JacksonJang Ok. As I suggested, it might need to be solved elsewhere. I am having Claude check this out as well. And it seems to zero in on POJOPropertiesCollector, fwtw.

@JacksonJang
Copy link
Contributor Author

Oh.. sorry for the confusion
I'll handle it in POJOPropertiesCollector.

@JacksonJang
Copy link
Contributor Author

JacksonJang commented Dec 2, 2025

@cowtowncoder
I tried, but I wasn’t able to handle it in POJOPropertiesCollector.

But I managed to minimize the double lookups in BeanDeserializer.
This seems to be the best solution for now.

I also added the test case(KotlinIssue308JsonIgnoreTest) you provided.


SettableBeanProperty prop = creator.findCreatorProperty(propName);
boolean isCreatorProp = (prop != null);
int ix = _propNameMatcher.matchName(propName);
Copy link
Member

@cowtowncoder cowtowncoder Dec 3, 2025

Choose a reason for hiding this comment

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

This is the actual lookup from hash structure so access is still duplicated unfortunately (getting property. But I have possible alternative solution, see #5457 .

Copy link
Member

Choose a reason for hiding this comment

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

Hmmh. Claude didn't actually verify the solution... need to iterate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's unfortunate..

I’ll try combining #5457 with the current code and work on it.

@cowtowncoder
Copy link
Member

The main challenge really is how to avoid automatic name-based ignoral: what should happen is that "split" property handling would ignore CreatorProperty but not renamed setter.
And logic for doing that should be in POJOPropertiesCollector, somehow, not later in BeanDeserializer.
In fact, name "id" should not be added to ignorals at all.

@JacksonJang
Copy link
Contributor Author

Thank you for the explanation.

I understand now that the key is to prevent the automatic name-based ignoral.

I’ll do my best to improve the logic accordingly.

@cowtowncoder
Copy link
Member

Resolved via different PR, closing.

@JacksonJang
Copy link
Contributor Author

JacksonJang commented Dec 3, 2025

@cowtowncoder

Would it be alright to open a new PR with the latest revision?
It’s a minor change, but I refactored the code so that the unnecessary SettableBeanProperty handling is now streamlined under a single prop variable.

link : 796281f

@cowtowncoder
Copy link
Member

cowtowncoder commented Dec 3, 2025 via email

@JacksonJang
Copy link
Contributor Author

Thanks :)

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