Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1862

Java thrift generated coe: default constructor initialize fields with default values but doesn't set their isSet flags

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 0.5
    • None
    • Java - Compiler
    • None
    • Mac

    Description

      I have thrift:

      const i16 CURRENT_VERSION = 10;
      
      struct SomeMsg {
        1: optional i16 currentVersion = CURRENT_VERSION;
      }
      

      Now, when the follow test will fail:

        SomeMsg msg = new SomeMsg();
        assertEquals(Constants.CURRENT_VESRION, msg.getCurrentVersion()); // pass
        assertTrue(msg.isSetCurrentVersion()); // fail.
      

      Question is: is this behavior by design?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jinfeng Jin Feng
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: