avro-util
avro-util copied to clipboard
validate output of SpecificData.get().getDefaultValue(field) in getSpecificDefaultValue()
scenario:
there's an enum class on the classpath of the same FQCN as an avro enum, but not generated by avro. avro (at least under 1.9) will return an instance of this non-avro enum out of:
@Override
public Object getSpecificDefaultValue(Schema.Field field) {
return SpecificData.get().getDefaultValue(field);
}
we could at least validate that the enum instance belongs to a class thats generated by avro, and save users some pain downstream
could use ClassValue to efficiently cache the validation by the class of the result.