Skip to content

Commit 0020fcb

Browse files
committed
Update release notes wrt #3699
1 parent 68ef028 commit 0020fcb

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

release-notes/CREDITS-2.x

+4
Original file line numberDiff line numberDiff line change
@@ -1528,3 +1528,7 @@ Moritz Halbritter (mhalbritter@github)
15281528
* Reported #3665: `ObjectMapper` default heap consumption increased significantly
15291529
from 2.13.x to 2.14.0
15301530
(2.14.1)
1531+
1532+
Philippe Marschall (marschall@github)
1533+
* Contributed #3699: Allow custom `JsonNode` implementations
1534+
(2.14.2)

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Project: jackson-databind
88

99
#1751: `@JsonTypeInfo` does not work if the Type Id is an Integer value
1010
(reported by @marvin-we)
11+
#3699: Allow custom `JsonNode` implementations
12+
(contributed by Philippe M)
1113

1214
2.14.1 (21-Nov-2022)
1315

src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java

+17-10
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,18 @@ public boolean handleUnknownProperty(DeserializationContext ctxt, JsonParser p,
523523
return true;
524524
}
525525
}).build();
526-
A aObject = mapper.readValue("{\"unknownField\" : 1, \"knownField\": \"test\"}", A.class);
526+
A2297 aObject = mapper.readValue("{\"unknownField\" : 1, \"knownField\": \"test\"}",
527+
A2297.class);
527528

528529
assertEquals("test", aObject.knownField);
529530
}
530531

531-
private static class A {
532+
// For [databind#2297]
533+
private static class A2297 {
532534
String knownField;
533535

534536
@JsonCreator
535-
private A(@JsonProperty("knownField") String knownField) {
537+
private A2297(@JsonProperty("knownField") String knownField) {
536538
this.knownField = knownField;
537539
}
538540
}
@@ -551,15 +553,18 @@ public void testCustomObjectNode() throws Exception
551553
public void testCustomArrayNode() throws Exception
552554
{
553555
ArrayNode defaultNode = (ArrayNode) MAPPER.readTree("[{\"x\": 1, \"y\": 2}]");
554-
CustomArrayNode customArrayNode = new CustomArrayNode(defaultNode);
556+
DelegatingArrayNode customArrayNode = new DelegatingArrayNode(defaultNode);
555557
Point[] points = MAPPER.readerFor(Point[].class).readValue(customArrayNode);
556558
Point point = points[0];
557559
assertEquals(1, point.x);
558560
assertEquals(2, point.y);
559561
}
560562

563+
// for [databind#3699]
561564
static class CustomObjectNode extends BaseJsonNode
562565
{
566+
private static final long serialVersionUID = 1L;
567+
563568
private final ObjectNode _delegate;
564569

565570
CustomObjectNode(ObjectNode delegate) {
@@ -681,11 +686,14 @@ public int hashCode() {
681686

682687
}
683688

684-
static class CustomArrayNode extends BaseJsonNode
689+
// for [databind#3699]
690+
static class DelegatingArrayNode extends BaseJsonNode
685691
{
692+
private static final long serialVersionUID = 1L;
693+
686694
private final ArrayNode _delegate;
687695

688-
CustomArrayNode(ArrayNode delegate) {
696+
DelegatingArrayNode(ArrayNode delegate) {
689697
this._delegate = delegate;
690698
}
691699

@@ -722,7 +730,7 @@ public void serializeWithType(JsonGenerator g, SerializerProvider ctxt, TypeSeri
722730
@Override
723731
@SuppressWarnings("unchecked")
724732
public <T extends JsonNode> T deepCopy() {
725-
return (T) new CustomArrayNode(_delegate);
733+
return (T) new DelegatingArrayNode(_delegate);
726734
}
727735

728736
@Override
@@ -785,17 +793,16 @@ public boolean equals(Object o) {
785793
if (o == this) {
786794
return true;
787795
}
788-
if (!(o instanceof CustomArrayNode)) {
796+
if (!(o instanceof DelegatingArrayNode)) {
789797
return false;
790798
}
791-
CustomArrayNode other = (CustomArrayNode) o;
799+
DelegatingArrayNode other = (DelegatingArrayNode) o;
792800
return this._delegate.equals(other._delegate);
793801
}
794802

795803
@Override
796804
public int hashCode() {
797805
return _delegate.hashCode();
798806
}
799-
800807
}
801808
}

0 commit comments

Comments
 (0)