Ryan Skraba created AVRO-3091:
---------------------------------
Summary: [Java] Specific record newBuilder() can create
unserializable records
Key: AVRO-3091
URL: https://issues.apache.org/jira/browse/AVRO-3091
Project: Apache Avro
Issue Type: Bug
Affects Versions: 1.10.2
Reporter: Ryan Skraba
The {{newBuilder()}} method in a generated Java specific record is meant to
ensure that the record is "complete" and serializable by the time the
{{build()}} method is called.
For example, if *{{MyRecord}}* has a required name field and no default:
{{MyRecord.newBuilder().build()}}
and
{{MyRecord.newBuilder().setName(null).build()}}
will both fail with an exception.
However, if *{{MyRecord}}* has a required name field and a default value, both
of the above calls will succeed, but only the first call will generate an
serializable record.
A complete example was provided on the [mailing
list|https://lists.apache.org/thread.html/r65818972aaeb39699b9c5c82dd9d213d7bd0274521e7f3086f8aa80e%40%3Cuser.avro.apache.org%3E].
--
This message was sent by Atlassian Jira
(v8.3.4#803005)