chaokunyang commented on code in PR #2338:
URL: https://github.com/apache/fory/pull/2338#discussion_r2153784840


##########
java/fory-core/src/main/java/org/apache/fory/codegen/Expression.java:
##########
@@ -2287,7 +2288,8 @@ public ExprCode doGenCode(CodegenContext ctx) {
       String i = ctx.newName("i");
       String elemValue = ctx.newName("elemValue");
       Expression elementExpr =
-          action.apply(new Reference(i), new Reference(elemValue, elementType, 
false));
+          action.apply(
+              new Reference(i), new Reference(elemValue, elementType, 
!elementType.isPrimitive()));

Review Comment:
   Could we add an `elementNullable` field and pass it when creating `ForEach` 
esxpression? And condition that `elementNullable` here?
   
   For 
`java/fory-core/src/main/java/org/apache/fory/builder/BaseObjectCodecBuilder#writeContainerElements`,
 we don't need `nullable` variable since we check and computed nullability 
ahead in `writeElementsHeader`



-- 
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]

Reply via email to