[
https://issues.apache.org/jira/browse/AVRO-3305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17485411#comment-17485411
]
ASF subversion and git services commented on AVRO-3305:
-------------------------------------------------------
Commit ceaf64952e2297964e82f400f426fc0490bf7fea in avro's branch
refs/heads/branch-1.11 from Kyle Carter
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=ceaf649 ]
AVRO-3305: Only mangle type identifier keywords when used as types (#1457)
* AVRO-3305: Only mangle type identifier keywords when types
Instead of treating all Java keywords identically, only mangles what
the JLS terms as "contextual keywords" when used in the context they
are reserved. Specifically, only mangle reserved type identifiers
when used as type identifiers.
* AVRO-3305: Extend tests to test mangling of all types of keywords
Previously tests only tested with a subset of the keywords accounted for
in the Avro compiler. This commit extends those tests to test against all
known keywords.
> Avro Compiler(s) should only mangle contextual reserved keyword when used in
> reserved context
> ---------------------------------------------------------------------------------------------
>
> Key: AVRO-3305
> URL: https://issues.apache.org/jira/browse/AVRO-3305
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.11.0
> Reporter: Kyle Carter
> Assignee: Kyle Carter
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.11.1
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> In AVRO-3116 it was correctly called out that new reserved keywords had been
> added to the Java language in recent versions that could lead to uncompilable
> Avro schemas in Java. While the fix developed for that issue does resolve the
> issue it treats all keywords identically. Some of the keywords (record,
> yield, var) targeted by that change are only keywords when used in particular
> contexts, specifically as a type identifier. Nevertheless, the Avro compiler
> code treats all keywords the same and will mangle them wherever they show up
> (for example in a package name) even if it would have been valid without
> mangling (ex: com.example.record). This can be surprising and result in
> unnecessary code updates.
> I suggest that these contextual keywords only be mangled when used in the
> context they are reserved.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)