[ 
https://issues.apache.org/jira/browse/AVRO-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17654947#comment-17654947
 ] 

Christophe Le Saec commented on AVRO-3698:
------------------------------------------

(y)
Could you please build a Pull Request on 
[github|https://github.com/apache/avro] , it's simpler for reviewing; and the 
CI result also help.

> [Java] SpecificData.getClassName must replace reserved words
> ------------------------------------------------------------
>
>                 Key: AVRO-3698
>                 URL: https://issues.apache.org/jira/browse/AVRO-3698
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.11.1
>            Reporter: Seung-Hyun Cheong
>            Priority: Major
>              Labels: newbie, patch
>             Fix For: 1.11.2
>
>         Attachments: AVRO-3698.patch
>
>
> [Java] SpecificData.getClassName must replace reserved words
>  
> When makes Java Class, SpecificCompiler adds "$" after reserved words like 
> public, new, etc...
> [https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1129]
> [https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L643]
>  
> For example, if the namespace of a schema is {*}db.public.table{*}, then the 
> package name of the generated Java Class, made by SpecificCompiler, is 
> {*}db.public$.table{*}. (Because *public* is a reserved word in java)
>  
> But when deserializes an Avro Record to a SpecificRecord, 
> SpecificData.getClassName returns {*}db.pulic.table.Name{*}.
>  
> So, it can't find a class by name from SpecificData.getClassName.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to