You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2020/03/04 16:49:00 UTC

[jira] [Commented] (AVRO-2769) After upgrade to 1.9.2, generated code for "put" uses value and value$

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

Ryan Skraba commented on AVRO-2769:
-----------------------------------

Hello!  I couldn't reproduce using avro-tools-1.9.2.jar, using this [schema|https://github.com/apache/avro/blob/branch-1.9/share/test/schemas/FooBarSpecificRecord.avsc].

{code}
java -jar ~/.m2/repository/org/apache/avro/avro-tools/1.9.2/avro-tools-1.9.2.jar compile schema share/test/schemas/FooBarSpecificRecord.avsc /tmp/output
{code}

Produces a record with: 

{code}
  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: id = (java.lang.Integer)value$; break;
    case 1: name = (java.lang.CharSequence)value$; break;
    case 2: nicknames = (java.util.List<java.lang.CharSequence>)value$; break;
    case 3: relatedids = (java.util.List<java.lang.Integer>)value$; break;
    case 4: typeEnum = (org.apache.avro.TypeEnum)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
{code}

I had the same results using the avro-maven-plugin.  Do you have any extra that might help track this down? 

> After upgrade to 1.9.2, generated code for "put" uses value and value$
> ----------------------------------------------------------------------
>
>                 Key: AVRO-2769
>                 URL: https://issues.apache.org/jira/browse/AVRO-2769
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.9.2
>         Environment: macOS Catalina
> JDK 8 (oracle)
>            Reporter: Alexander Ubillus
>            Priority: Blocker
>
> After upgrade to 1.9.2, generated code for "put" uses value and value$, causing compilation exceptions:
> {code:java}
>   // Used by DatumReader.  Applications should not call.
>   @SuppressWarnings(value="unchecked")
>   public void put(int field$, java.lang.Object value$) {
>     switch (field$) {
>     case 0: name = (java.lang.CharSequence)value; break;
>     case 1: length = (java.math.BigDecimal)value; break;
>     case 2: metadata = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)value; break;
>     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
>     }
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)