Skip to content

Commit c1e8b70

Browse files
committed
Fix #2980 test (test was faulty, behavior not :) )
1 parent 13a7d61 commit c1e8b70

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,8 @@ protected void _addExplicitDelegatingCreator(DeserializationContext ctxt,
851851
}
852852

853853
/**
854-
* Helper method called when there is the explicit "is-creator" with mode of "properties-based"
854+
* Helper method called when there is the explicit "is-creator" annotation with mode
855+
* of "properties-based"
855856
*
856857
* @since 2.9.2
857858
*/
@@ -1072,7 +1073,6 @@ private void _checkImplicitlyNamedConstructors(DeserializationContext ctxt,
10721073
}
10731074
}
10741075

1075-
10761076
protected boolean _handleSingleArgumentCreator(CreatorCollector creators,
10771077
AnnotatedWithParams ctor, boolean isCreator, boolean isVisible)
10781078
{

src/test-jdk14/java/com/fasterxml/jackson/databind/RecordCreatorsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public RecordWithAltCtor(@JsonProperty("id") int id) {
2222

2323
// [databind#2980]
2424
record RecordWithDelegation(String value) {
25-
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
25+
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
2626
public RecordWithDelegation(String value) {
2727
this.value = "del:"+value;
2828
}
@@ -31,6 +31,8 @@ public RecordWithDelegation(String value) {
3131
public String getValue() {
3232
return "val:"+value;
3333
}
34+
35+
public String accessValueForTest() { return value; }
3436
}
3537

3638
private final ObjectMapper MAPPER = newJsonMapper();
@@ -59,7 +61,7 @@ public void testDeserializeWithAltCtor() throws Exception {
5961
public void testDeserializeWithDelegatingCtor() throws Exception {
6062
RecordWithDelegation value = MAPPER.readValue(q("foobar"),
6163
RecordWithDelegation.class);
62-
assertEquals("del:foobar", value.getValue());
64+
assertEquals("del:foobar", value.accessValueForTest());
6365

6466
assertEquals(q("val:del:foobar"), MAPPER.writeValueAsString(value));
6567
}

0 commit comments

Comments
 (0)