Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2771

Java 1.9.X doesn't allow having Error in a Record

    XMLWordPrintableJSON

Details

    Description

      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:

      [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 

       

       

      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):

      mvn install -Davro.version=1.9.2
      mvn install -Davro.version=1.8.2

       

      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

      Attachments

        Issue Links

          Activity

            People

              opwvhk Oscar Westra van Holthe - Kind
              cddude229 Chris Dessonville
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m