Skip to content

Conversation

JooHyukKim
Copy link
Member

@JooHyukKim JooHyukKim commented Sep 6, 2025

Fix ---#5238--- #5262

Comment on lines +1503 to +1507
if (getObjectIdInfo() != null) {
renamed.add(prop);
} else {
renamed.add(prop.withName(n));
}
Copy link
Member Author

@JooHyukKim JooHyukKim Sep 6, 2025

Choose a reason for hiding this comment

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

Turns out was serializing id as prefixId (from creator).
So I thought... if objectId, let's not rename?

Copy link
Member

Choose a reason for hiding this comment

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

Hmmmh. Actually, I think this test is invalid! Renaming should be done, as described.

And would occur in 2.x if ParameterNamesModule was registered.

Sorry for wasting you time here @JooHyukKim :-(

Copy link
Member Author

Choose a reason for hiding this comment

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

No issue, but I am still concerened there might be issue because the serialization output changed from "id" to "prefixId" 🤔
Or could that also be affected by ALLOW_FINAL_FIELDS_AS_GETTERS?

Copy link
Member

Choose a reason for hiding this comment

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

Difference is, I think, that 2.x does not get implicit names from constructor parameters (without ParameterNamesModule); 3.x does. So renaming works as -- I think -- it actually should, in 3.x (and in 2.x if PNM was registered).

Why @JsonProperty("prefixId") was added I do not know: seems like a mistake.

@JooHyukKim JooHyukKim changed the title Fix 5238 regression Fix Jackson 3 regression for @JsonIdentityInfo #5238 Sep 6, 2025
@cowtowncoder
Copy link
Member

Closed since there isn't a bug to fix, I think. Not sure why original test had that rename... but that seems wrong.

@JooHyukKim
Copy link
Member Author

Ah so it just worked in 2.x then?

@cowtowncoder
Copy link
Member

Ah so it just worked in 2.x then?

Yes and no; 2.x just did not apply rename due to missing constructor parameter name (due to not registering ParameterNamesModule). But yes in that it worked the way test wrt POJOs was written... but that way seems wrong to me, when reading it with thought.

@JooHyukKim
Copy link
Member Author

Okay, this is still a behavior change from Jackson 2 to 3.

So I am still wondering how we should be concluding this case, if...

  • should this be documented or
  • can we suggest alternative?
  • just say this never was a feature so no alternative

WDYT?

@cowtowncoder
Copy link
Member

Test case would have failed in 2.x too if ParameterNamesModule was registered (or we used @ImplicitName test module) so that is the only difference -- and this is documented in release notes.

But I don't think this was a valid test case: the original problem was fixed. And changes in handling of invalid usage is not something we need or should document.

@cowtowncoder
Copy link
Member

@JooHyukKim but just to be sure: is there part of handling wrt the original reported problem (#5238) you think did get worse? I hope I am not missing something obvious: I just do not recall use of "prefixId" there.

@JooHyukKim
Copy link
Member Author

If we are talking about directly part of the original report, not much issue I guess.

But one thing finding it odd.

Is that assumption that we possibly start considering paramnames module affecting behaviors by default. I dont think we made warning or suggest alternative (or as far as I remember).

Would be good to "disable" already integrated paramnames module functionaity like MapperBuilder.disable() method.
Or make part of jackson2defaults() method we wrote way back.

@cowtowncoder
Copy link
Member

@JooHyukKim To be honest, I think lack of parameter names is the flaw and everyone should have been using parameter names module.

Having said that, if there was a new MapperFeature added for 3.0 to allow disabling introspection (defaulting to enabled), that could be reasonable. This could then be disabled by "jackson2defaults".

@JooHyukKim
Copy link
Member Author

JooHyukKim commented Sep 14, 2025

Having said that, if there was a new MapperFeature added for 3.0 to allow disabling introspection (defaulting to enabled), that could be reasonable. This could then be disabled by "jackson2defaults".

Wrote #5315 as a follow up. Implementation seems clean (I think)

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