[ 
https://issues.apache.org/jira/browse/AVRO-2771?focusedWorklogId=780797&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-780797
 ]

ASF GitHub Bot logged work on AVRO-2771:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jun/22 12:15
            Start Date: 13/Jun/22 12:15
    Worklog Time Spent: 10m 
      Work Description: opwvhk opened a new pull request, #1720:
URL: https://github.com/apache/avro/pull/1720

   Moved the isError check for the "custom codable" check to fix a
   backwards compatibility issue between versions 1.8.x & 1.9.x.
   
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [X] My PR addresses the following [Avro 
Jira](https://issues.apache.org/jira/browse/AVRO/) issues and references them 
in the PR title. For example, "AVRO-1234: My Avro PR"
     - https://issues.apache.org/jira/browse/AVRO-2771
     - In case you are adding a dependency, check if the license complies with 
the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   
   ### Tests
   
   - [X] My PR adds the following unit tests ~__OR__ does not need testing for 
this extremely good reason~:
      `org.apache.avro.specific.TestGeneratedCode#withErrorField`
   
   ### Commits
   
   - [X] My commits all reference Jira issues in their subject lines. In 
addition, my commits follow the guidelines from "[How to write a good git 
commit message](https://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [X] In case of new functionality, my PR adds documentation that describes 
how to use it.
     - All the public functions and the classes in the PR contain Javadoc that 
explain what it does
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 780797)
    Remaining Estimate: 0h
            Time Spent: 10m

> Java 1.9.X doesn't allow having Error in a Record
> -------------------------------------------------
>
>                 Key: AVRO-2771
>                 URL: https://issues.apache.org/jira/browse/AVRO-2771
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.9.0, 1.9.1, 1.9.2
>            Reporter: Chris Dessonville
>            Assignee: Oscar Westra van Holthe - Kind
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> While trying to upgrade from AVRO 1.8.2 to 1.9.X, we hit an unexpected 
> compilation error.  The same code works fine in 1.8.2 and even sends over the 
> wire correctly, so it's definitely been supported historically.  The issue 
> occurs when you put an {{error}} inside of a {{record}}.  I've created a 
> project (further below) to show the issue.
>  
> The errors seen is this:
> {code:java}
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] 
> /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[324,19]
>  cannot find symbol
>   symbol:   method customEncode(org.apache.avro.io.Encoder)
>   location: variable someError of type MyError
> [ERROR] 
> /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[336,21]
>  cannot find symbol
>   symbol:   method customDecode(org.apache.avro.io.ResolvingDecoder)
>   location: variable someError of type MyError
> [ERROR] 
> /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[345,25]
>  cannot find symbol
>   symbol:   method customDecode(org.apache.avro.io.ResolvingDecoder)
>   location: variable someError of type MyError
> [INFO] 3 errors {code}
>  
>  
> Sample project: [https://github.com/cddude229/avro-1-9-x-error-in-record]
>  
> Commands you can use (defaults to 1.8.2 since that compiles):
> {code:java}
> mvn install -Davro.version=1.9.2
> mvn install -Davro.version=1.8.2{code}
>  
> In terms of solutions, I'd love to see the old behavior restored.  However, 
> if avro is moving to stop supporting an {{error}} in a {{record}}, then I'd 
> suggest that this be a schema validation/error then, instead of while 
> compiling Java.
>  
> NOTE: This is not unique to my/my company's use case - someone on SO also hit 
> this: 
> [https://stackoverflow.com/questions/56977080/avro-1-9-0-failed-to-compile-generated-java-code-with-error-message-cannot-find]



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to