You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Philip Zeyliger (JIRA)" <ji...@apache.org> on 2009/11/20 03:14:39 UTC

[jira] Created: (AVRO-221) Mangle conflicting names in generated code for Java

Mangle conflicting names in generated code for Java
---------------------------------------------------

                 Key: AVRO-221
                 URL: https://issues.apache.org/jira/browse/AVRO-221
             Project: Avro
          Issue Type: Improvement
          Components: java
            Reporter: Philip Zeyliger
            Assignee: Philip Zeyliger


Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780473#action_12780473 ] 

Philip Zeyliger commented on AVRO-221:
--------------------------------------

+1.

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>             Fix For: 1.3.0
>
>         Attachments: AVRO-221.patch, AVRO-221.patch.txt
>
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philip Zeyliger updated AVRO-221:
---------------------------------

    Attachment: AVRO-221.patch.txt

Here's an attempt at this.  This doesn't support evil things, like schemas with both "finally_" and "finally", but it does generate what ought to be valid code.

Really, the tests ought to compile (using javac from tools.jar, say), but this patch doesn't do that.

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>         Attachments: AVRO-221.patch.txt
>
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-221:
------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]
          Status: Resolved  (was: Patch Available)

I just committed this.  Thanks, Philip.

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>             Fix For: 1.3.0
>
>         Attachments: AVRO-221.patch, AVRO-221.patch.txt
>
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780378#action_12780378 ] 

Philip Zeyliger commented on AVRO-221:
--------------------------------------

>From the -dev list:

{quote}
Philip Zeyliger wrote:

    I think that for keywords, that language's implementation should
    generate something sensible if there's code generation installed.  So,
    the Java specific compiler could have a list of Java keywords
    embedded.  If it sees "long", it just replaces it with "long_" in the
    generated code.  The only reserved words in Avro are the names of
    built-in avro types...

    Would that be sensible?


+1 I agree that we should only mangle names when they conflict.

Doug
{quote}

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-221:
------------------------------

    Fix Version/s: 1.3.0
           Status: Patch Available  (was: Open)

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>             Fix For: 1.3.0
>
>         Attachments: AVRO-221.patch, AVRO-221.patch.txt
>
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-221) Mangle conflicting names in generated code for Java

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-221:
------------------------------

    Attachment: AVRO-221.patch

Here's a version that uses dollar instead of underscore.  Dollar is not permitted in Avro identifiers and is thus preferred.

> Mangle conflicting names in generated code for Java
> ---------------------------------------------------
>
>                 Key: AVRO-221
>                 URL: https://issues.apache.org/jira/browse/AVRO-221
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>             Fix For: 1.3.0
>
>         Attachments: AVRO-221.patch, AVRO-221.patch.txt
>
>
> Generated Java code should support fields that conflict with Java reserved words.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.