[ https://issues.apache.org/jira/browse/AVRO-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828211#action_12828211 ]
Doug Cutting commented on AVRO-261: ----------------------------------- Thiru: does wrapping these not affect performance? Many operations iterate over fields or lookup enum symbols. The immutable wrapper adds another method call to each such operation. Philip> I also wish that we could just get rid of setFields() altogether, relying on the constructor. The problem is that, since schemas can be circular, we need to create it first, so that we can point back to it from its fields. So, in general, we'd need to make constructors for schemas with nested schemas (records, maps, arrays) accept names for these schemas instead of the actual schemas, and resolve these later, as a fixup pass. So it would still be a two-step API: constructor & fixup. The fixup could be done lazily, but that would insert runtime checks. > Allow Schemas to be immutable > ----------------------------- > > Key: AVRO-261 > URL: https://issues.apache.org/jira/browse/AVRO-261 > Project: Avro > Issue Type: New Feature > Components: java > Reporter: Kevin Oliver > Assignee: Thiruvalluvan M. G. > Priority: Minor > Attachments: AVRO-261.patch > > > It would be nice if there was the ability to have an immutable Schema in > java. > Without this, it makes sharing schemas risky. Also, with this, we could > (lazily) cache the hashCode which is a fairly expensive operation today, > especially on something like a record. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.