Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,12 @@ protected void _renameProperties(Map<String, POJOPropertyBuilder> props)
// simple renaming? Just do it
if (l.size() == 1) {
PropertyName n = l.iterator().next();
renamed.add(prop.withName(n));
if (getObjectIdInfo() != null) {
renamed.add(prop);
} else {
renamed.add(prop.withName(n));
}
Comment on lines +1503 to +1507
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.


continue;
}
// but this may be problematic...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tools.jackson.databind.records.tofix;
package tools.jackson.databind.records;

import java.util.List;

Expand All @@ -8,7 +8,6 @@

import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.testutil.DatabindTestUtil;
import tools.jackson.databind.testutil.failure.JacksonTestFailureExpected;

import static org.junit.jupiter.api.Assertions.*;

Expand Down Expand Up @@ -51,7 +50,6 @@ public ThingPojo(@JsonProperty("prefixId") int id, @JsonProperty("name") String
private final ObjectMapper MAPPER = newJsonMapper();

// [databind#5262]: Regression in 3.0?
@JacksonTestFailureExpected
@Test
void testIdentityWithPojo() throws Exception {
ThingPojo t1 = new ThingPojo(1, "a");
Expand Down
Loading