Skip to content

Commit

Permalink
Only deep reset if default object is of the same type as current and …
Browse files Browse the repository at this point in the history
…is not null

Change API to remove redundant defaults param
Revert "Disable deep resetting for object fields #745"
This reverts commit 96bcb58.
  • Loading branch information
alamar committed Oct 30, 2023
1 parent 4375e97 commit cb3bf80
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException, In

// Use the WireMarshaller to read the configuration
// Field that are not present in the input are not touched.
wm.readMarshallable(this, wire, wm.defaultValue(), false);
wm.readMarshallable(this, wire, false);
}

/**
Expand All @@ -69,7 +69,7 @@ public void writeMarshallable(@NotNull WireOut wire) throws InvalidMarshallableE

// Use the WireMarshaller to write the configuration
// Fields with a default value are not written
marshaller.writeMarshallable(this, wire, marshaller.defaultValue(), false);
marshaller.writeMarshallable(this, wire, false);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/openhft/chronicle/wire/Marshallable.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ default void readMarshallable(@NotNull WireIn wire) throws IORuntimeException, I
WireMarshaller<Object> wm = WIRE_MARSHALLER_CL.get(this.getClass());

// Delegate the reading process to the obtained WireMarshaller
wm.readMarshallable(this, wire, wm.defaultValue(), true);
wm.readMarshallable(this, wire, true);
}

/**
Expand Down
Loading

0 comments on commit cb3bf80

Please sign in to comment.