[
https://issues.apache.org/jira/browse/AVRO-2808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on AVRO-2808 started by Andy Le.
-------------------------------------
> Java: ReflectData incorrectly handles hidden fields
> ---------------------------------------------------
>
> Key: AVRO-2808
> URL: https://issues.apache.org/jira/browse/AVRO-2808
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.9.2
> Reporter: Andy Le
> Assignee: Andy Le
> Priority: Major
>
> Hi guys,
> I've got the following test:
> {code:java}
> public ReflectTest{
> public class Definition {
> public Map<String, Type> tokens;
> }
> public enum Type {
> A,
> B,
> C
> }
> @Test
> public void testAvro2805() {
> Schema schema = ReflectData.get().getSchema(Definition.class);
> final String schemaString = schema.toString(true);
> System.out.println(schemaString);
> }
> }
> {code}
> When I ran the test, an exception is raised:
> {noformat}
> org.apache.avro.SchemaParseException: Illegal character in: this$0
> at org.apache.avro.Schema.validateName(Schema.java:1530)
> at org.apache.avro.Schema.access$400(Schema.java:87)
> at org.apache.avro.Schema$Field.<init>(Schema.java:518)
> at org.apache.avro.Schema$Field.<init>(Schema.java:557)
> at
> org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:683)
> at
> org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:335)
> at
> org.apache.avro.specific.SpecificData$3.computeValue(SpecificData.java:332)
> {noformat}
> From the log, you may see that: we should not handle Java hidden field
> `this$0` which is used to hold reference to outer class instances.
> This issue is somehow related to [this
> one|https://issues.apache.org/jira/browse/AVRO-2805]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)