Werner Daehn created AVRO-2423: ---------------------------------- Summary: GenericDatumReader.newRecord() is depricated but newArray() is not Key: AVRO-2423 URL: https://issues.apache.org/jira/browse/AVRO-2423 Project: Apache Avro Issue Type: Bug Components: java Affects Versions: 1.8.2, 1.10.0 Reporter: Werner Daehn
The GenericDatumReader method newRecord() should no longer be used because breaks one area in the extensibility concept of the GenericRecords. Perfect. Good idea. But with the same argument the newArray() method should be depreciated and instead use the GenericData.newArray() method. Without that the extensibility is broken again and we have an inconsistency in the API. {{/**}} {{ * Called to create new record instances. Subclasses may override to use a}} {{ * different record implementation. The returned instance must conform to the}} {{ * schema provided. If the old object contains fields not present in the}} {{ * schema, they should either be removed from the old object, or it should}} {{ * create a new instance that conforms to the schema. By default, this returns}} {{ * a \{@link GenericData.Record}.}} {{ * @deprecated As of Avro 1.6.0 this method has been moved to}} {{ * \{@link GenericData#newRecord(Object, Schema)}}} {{ */}} {{ @Deprecated}} {{ protected Object newRecord(Object old, Schema schema) {}} {{ return data.newRecord(old, schema);}} {{ }}}{{/** Called to create new array instances. Subclasses may override to use a}} {{ * different array implementation. By default, this returns a {@link}} {{ * GenericData.Array}.*/}} {{ @SuppressWarnings("unchecked")}} {{ protected Object newArray(Object old, int size, Schema schema) {}} {{ if (old instanceof Collection) {}} {{ ((Collection) old).clear();}} {{ return old;}} {{ } else return new GenericData.Array(size, schema);}} {{ }}} -- This message was sent by Atlassian JIRA (v7.6.3#76005)