Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-332

Gora 0.4 compiler generate invalid Java code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4, 0.5
    • 0.5
    • gora-compiler

    Description

      Pursuing my journey on GORA-199 I've detected another issue with Gora compiler.if there is a "bytes" type field inside a record.

      {
          "name": "RecordWityBytes",
          "namespace": "com.drazzib.com",
          "type": "record",
          "fields": [
              {
                  "name": "type",
                  "type": {
                      "name": "MyData",
                      "type": "bytes"
                  }
              }
          ]
      }
      

      Gora 0.4 will generate java code without crashing but if you try to compile generated code with javac, you'll get the following error :

      $> ./bin/gora goracompiler record_with_bytes.avsc test/
      Compiling: /home/drazzib/incoming/apache-gora-0.4/record_with_bytes.avsc
      Compiled into: /home/drazzib/incoming/apache-gora-0.4/test
      Compiler executed SUCCESSFULL.
      
      $> find test/ -name *.java | xargs javac -cp gora-core/target/classes/:gora-core/lib/avro-1.7.4.jar:gora-core/lib/jackson-core-asl-1.6.9.jar -d test/
      test/com/drazzib/com/RecordWityBytes.java:92: error: cannot find symbol
          this.type = deepCopyToReadOnlyBuffer(value);
                      ^
        symbol:   method deepCopyToReadOnlyBuffer(ByteBuffer)
        location: class RecordWityBytes
      1 error
      

      You can clone this gist https://gist.github.com/drazzib/263da2ec0dc46afac0d0 to easily reproduce this issue.

      Attachments

        Activity

          People

            drazzib Damien Raude-Morvan
            drazzib Damien Raude-Morvan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: