Thebas opened a new pull request, #7224: URL: https://github.com/apache/incubator-kie/pull/7224
**Issue**: * https://github.com/apache/incubator-kie-issues/issues/2419 **Description** With the executable model, `from collect` into a concrete collection class (`ArrayList`, `LinkedList`, `HashSet`, custom classes) is handled by `GenericCollectAccumulator`. When the collected pattern runs in a subnetwork (an inner `from`, `from accumulate` or a nested `from collect`), `accumulate()` added the `SubnetworkTuple` itself to the collection instead of the matched fact. Rules reading the elements broke, and marshalling the session failed with `NotSerializableException: AccumulateNode$AccumulateContext`. The fix unwraps the tuple through its fact handle, as the classic `CollectAccumulator` does: ```java Object value = handle.getObject(); if (value instanceof SubnetworkTuple) { value = ( (SubnetworkTuple) value ).getFactHandle().getObject(); } ``` `accumulate()` returns the unwrapped value, which Drools passes back to `tryReverse()`, so retraction removes the right element. **Tests** - `drools-model-codegen` `AccumulateTest`: 9 tests, run with both the classic engine and the executable model. They cover `ArrayList`, `LinkedList`, `HashSet`, `Set`, a custom collection class, update and delete of the parent fact, an inner `from accumulate` and a nested `from collect`. Every concrete-collection case fails without the fix in executable-model mode and passes with it. `Set()` passes either way, as it never went through `GenericCollectAccumulator`. - `test-compiler-integration` `AccumulateTest.testMarshallCollectIntoArrayListFromSubnetwork`: marshalling round trip with `SerializablePlaceholderResolverStrategy`. It failed with the `NotSerializableException` before the fix. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
