Joseph Price created AVRO-3749:
----------------------------------
Summary: incorrect conflicting field when field name starts with
symbols
Key: AVRO-3749
URL: https://issues.apache.org/jira/browse/AVRO-3749
Project: Apache Avro
Issue Type: Bug
Affects Versions: 1.11.1
Reporter: Joseph Price
When a field name has leading symbolic characters, it is detected as a
conflicting name, causing the generated java method to be suffixed with "$1".
Although the generated code is usable, I encountered this when trying to a use
a Debezium schema from Flink, where flink's AvroTypeInfo class fails to
generated a Flink schema due to an apparent limitation in handling of special
characters in method names. Here is an example schema that exhibits the issue:
{code:java}
{
"name": "Value",
"type": "record",
"fields": [
{
"name": "__deleted",
"type": "string"
}
]
}{code}
The code causing the spurious conflict detection is here:
[https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1262-L1264]
I was able to work around it with a locally published version that checks for
isAlphanumeric on the first letter, but that doesn't handle the indent of the
code, since I assume a correct implementation would generate mangled names even
for conflicting methods that start with symbols, e.g.
{code:java}
__deleted -> getDeleted
__Deleted -> getDeleted$1
{code}
So, find first alphanumeric char, then apply the transformation to find dupes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)