Copilot commented on code in PR #6538:
URL:
https://github.com/apache/incubator-kie-drools/pull/6538#discussion_r2585102980
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/CoerceUtil.java:
##########
@@ -48,6 +49,11 @@ static Object actualCoerceValue(DMNType requiredType, Object
valueToCoerce) {
// and vice-versa
return ((Collection) valueToCoerce).toArray()[0];
}
+ if (requiredType.isCollection() && !(valueToCoerce instanceof
Collection) &&
+ (!(requiredType instanceof SimpleTypeImpl simpleType)
+ || simpleType.getFeelType() != BuiltInType.UNKNOWN)) {
+ return Collections.singletonList(valueToCoerce);
+ }
Review Comment:
The new coercion logic for wrapping non-collection values into singleton
lists lacks unit test coverage in CoerceUtilTest.java. Consider adding a test
case that verifies this behavior, similar to the existing
`actualCoerceValueCollectionToArray` test but in the opposite direction (e.g.,
`actualCoerceValueArrayToCollection`).
--
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]