Unable to generate Java from multi avsc
I have a Jar with multiple AVSC files. These were generated from AVDL files. For example:
@namespace("com.example")
protocol MyProtocol {
record Metadata {
string sender;
}
record MyRecord {
Metadata metadata;
string name;
int age;
}
record MyRecord2 {
Metadata metadata;
string country;
}
}
This will generate 2 AVSC files, which both contain the definition for Metadata. When I try to compile it I get something like:
* MyRecord2.avsc: Can't redefine: com.example.Metadata
It seems that this issue is fixed in Avro, but I still get it: https://issues.apache.org/jira/browse/AVRO-3940
I can fix it when I change bridge/src/main/java/com/github/sbt/avro/AvscFilesParser.java and put this parser = parserSupplier.get(); on line 47, thus not reusing the same parser for every file.
Thanks for the bug report, will have a look this week. This use case should definitly be integrated in our test suite.
This looks to be a bug upstream. I commended on the ASF Jira ticket. In the test suite, if I redeclare an enum, it's all fine as long as they are equal. If I redeclare a records it does not work because equality check is dones on a non complete record, before fields are populated.
See https://github.com/apache/avro/pull/3304
Nice. Thanks for following up!