Skip to content

Commit

Permalink
fix InvokeHint conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
chaokunyang committed Jan 28, 2025
1 parent 75e7e4b commit 702e661
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ public InvokeHint add(Expression cutPoint) {
return this;
}

public InvokeHint copy() {
InvokeHint invokeHint = new InvokeHint(genNewMethod);
invokeHint.cutPoints = new HashSet<>(cutPoints);
return invokeHint;
}

@Override
public String toString() {
return "InvokeHint{" + "genNewMethod=" + genNewMethod + ", cutPoints=" + cutPoints + '}';
Expand Down Expand Up @@ -1691,8 +1697,8 @@ private Expression readContainerElement(
read =
new If(
hasNull,
deserializeFor(buffer, elementType, callback, invokeHint),
callback.apply(deserializeForNotNull(buffer, elementType, invokeHint)));
deserializeFor(buffer, elementType, callback, invokeHint.copy()),
callback.apply(deserializeForNotNull(buffer, elementType, invokeHint.copy())));
}
} else {
invokeHint.add(elemSerializer);
Expand All @@ -1712,9 +1718,11 @@ private Expression readContainerElement(
buffer,
elementType,
callback,
() -> deserializeForNotNull(buffer, elementType, elemSerializer, invokeHint)),
() ->
deserializeForNotNull(
buffer, elementType, elemSerializer, invokeHint.copy())),
callback.apply(
deserializeForNotNull(buffer, elementType, elemSerializer, invokeHint)));
deserializeForNotNull(buffer, elementType, elemSerializer, invokeHint.copy())));
}
}
return read;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ public void testWildcard(boolean referenceTrackingConfig) {
Fury fury =
Fury.builder()
.withRefTracking(referenceTrackingConfig)
.withCodegen(true)
.requireClassRegistration(false)
.build();
MapWildcardFieldStruct1 struct = new MapWildcardFieldStruct1();
Expand All @@ -843,4 +842,23 @@ public void testWildcard(boolean referenceTrackingConfig) {
struct.f5 = ofHashMap("k5", new Wildcard1<>());
serDeCheck(fury, struct);
}

@Data
public static class NestedListMap {
public List<Map<String, String>> map1;
public List<HashMap<String, String>> map2;
}

@Test(dataProvider = "referenceTrackingConfig")
public void testNestedListMap(boolean referenceTrackingConfig) {
Fury fury =
Fury.builder()
.withRefTracking(referenceTrackingConfig)
.requireClassRegistration(false)
.build();
NestedListMap o = new NestedListMap();
o.map1 = ofArrayList(ofHashMap("k1", "v"));
o.map2 = ofArrayList(ofHashMap("k2", "2"));
serDeCheck(fury, o);
}
}

0 comments on commit 702e661

Please sign in to comment.