Cole-Greer commented on code in PR #2919:
URL: https://github.com/apache/tinkerpop/pull/2919#discussion_r1862750059
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SideEffectStrategy.java:
##########
@@ -60,7 +61,11 @@ public static <A> void addSideEffect(final
TraversalStrategies traversalStrategi
strategy = cloneStrategy;
traversalStrategies.addStrategies(strategy);
}
- strategy.sideEffects.add(new Triplet<>(key, value instanceof Supplier
? (Supplier) value : new ConstantSupplier<>(value), reducer));
+
+ // don't want the GValue to leak beyond strategy application or else
the Supplier will start producing it
+ // during execution
+ final ConstantSupplier initialValue = value instanceof GValue ? new
ConstantSupplier<>(((GValue) value).get()) : new ConstantSupplier<>(value);
+ strategy.sideEffects.add(new Triplet<>(key, value instanceof Supplier
? (Supplier) value : initialValue, reducer));
Review Comment:
Yes that is possible. Nice catch! I've updated the logic such that any
GValue supplied by a `Supplier<GValue>` will be unboxed as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]