Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4655 Parser fails on the word "from"
  3. THRIFT-3956

Java keywords that are legal in IDL can lead to generated code that will not compile

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.10.0, 0.11.0
    • Fix Version/s: None
    • Component/s: Java - Compiler
    • Labels:
      None

      Description

      Consider the following IDL, which is legal and leads to successful source code generation using the Java generator:

      struct int {
        1: i32 val
      }
      
      struct boolean {
        1: bool val
      }
      
      struct long {
        1: i64 val
      }
      
      struct short {
        1: i16 short
      }
      
      struct char {
        1: i16 val
      }
      
      struct Primitives {
        1: i32 int,
        2: i64 long,
        3: i16 short,
        4: bool boolean,
        5: i16 char
      }
      

      The generated does not compile because the struct names and fields names are reserved keywords in Java, even though they are not reserved words in the Thrift compiler.

        Attachments

          Activity

            People

            • Assignee:
              jensg Jens Geyer
              Reporter:
              bcg Benjamin Gould
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: