@@ -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