[
https://issues.apache.org/jira/browse/AVRO-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755957#comment-17755957
]
ASF subversion and git services commented on AVRO-3749:
-------------------------------------------------------
Commit 2ad42c1136a1986f5640c4f41092bcba892da272 in avro's branch
refs/heads/master from Christophe Le Saec
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=2ad42c113 ]
AVRO-3749: avoid conflict in method name for generated code (#2435)
> 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
> Assignee: Christophe Le Saec
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> 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)