@@ -262,8 +262,7 @@ public Integer getAsInteger(String path) {
262262 }
263263 }
264264
265- @ Override
266- public Node clone () {
265+ public Node clone2 () {
267266 try {
268267 Node cloned = (Node ) super .clone ();
269268 if (this .type != null ) {
@@ -300,6 +299,61 @@ public Node clone() {
300299 }
301300 }
302301
302+ @ Override
303+ public Node clone () {
304+ try {
305+ Node cloned = (Node ) super .clone ();
306+
307+ cloned .name = this .name ;
308+ cloned .description = this .description ;
309+ cloned .value = this .value ;
310+
311+ if (this .type != null ) {
312+ cloned .type = this .type .clone ();
313+ }
314+
315+ if (this .itemType != null ) {
316+ cloned .itemType = this .itemType .clone ();
317+ }
318+
319+ if (this .keyType != null ) {
320+ cloned .keyType = this .keyType .clone ();
321+ }
322+
323+ if (this .valueType != null ) {
324+ cloned .valueType = this .valueType .clone ();
325+ }
326+
327+ if (this .items != null ) {
328+ cloned .items = this .items .stream ()
329+ .map (Node ::clone )
330+ .collect (Collectors .toCollection (ArrayList ::new ));
331+ }
332+
333+ if (this .properties != null ) {
334+ cloned .properties = this .properties .entrySet ().stream ()
335+ .collect (Collectors .toMap (
336+ Map .Entry ::getKey ,
337+ entry -> entry .getValue ().clone (),
338+ (e1 , e2 ) -> e1 ,
339+ HashMap ::new
340+ ));
341+ }
342+
343+ if (this .constraints != null ) {
344+ cloned .constraints = this .constraints .clone ();
345+ }
346+
347+ if (this .blue != null ) {
348+ cloned .blue = this .blue .clone ();
349+ }
350+
351+ return cloned ;
352+ } catch (CloneNotSupportedException e ) {
353+ throw new AssertionError ("Node must be cloneable" , e );
354+ }
355+ }
356+
303357 @ Override
304358 public String toString () {
305359 return "Node{" +
0 commit comments