opwvhk commented on a change in pull request #1412:
URL: https://github.com/apache/avro/pull/1412#discussion_r755783782



##########
File path: 
lang/java/compiler/src/main/java/org/apache/avro/compiler/idl/ResolvingVisitor.java
##########
@@ -139,10 +139,7 @@ public SchemaVisitorAction afterVisitNonTerminal(final 
Schema nt) {
         List<Schema.Field> fields = nt.getFields();
         List<Schema.Field> newFields = new ArrayList<>(fields.size());
         for (Schema.Field field : fields) {
-          Schema.Field newField = new Schema.Field(field.name(), 
replace.get(field.schema()), field.doc(),
-              field.defaultVal(), field.order());
-          copyAllProperties(field, newField);
-          newFields.add(newField);
+          newFields.add(new Field(field, replace.get(field.schema())));

Review comment:
       In the previous version, `field.defaultVal()` results in `null` for 
**all** default values if the type is not yet resolved.
   By using the `Field(Field, Schema)` constructor, the underlying JSON object 
is used, preserving the default value.




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


Reply via email to