Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/com/amazon/ion/impl/lite/IonStructLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ private IonStruct doClone(boolean keep, String... fieldNames)
// This ensures that we don't copy an unknown field name.
clonedChild._fieldName = value.getFieldName();
clonedChild._elementid(clone._child_count);
clonedChild._context = clone;
if (!clone._isSymbolIdPresent() && clonedChild._isSymbolIdPresent())
{
clone.cascadeSIDPresentToContextRoot();
Expand Down
9 changes: 9 additions & 0 deletions test/com/amazon/ion/StructTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,15 @@ public void testRemoveAfterClone()
assertNull(s2.get("b"));
}

@Test
public void testRemoveAfterCloneAndRemove() {
IonStruct struct1 = (IonStruct) system().singleValue("{a:1,b:2}");
IonStruct struct2 = struct1.cloneAndRemove("a");

assertNotNull(struct2.remove("b"));
assertFalse(struct2.containsKey("b"));
}

@Test
public void testPutOfClone()
{
Expand Down