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

Dynamic and Specific APIs could be generified for better type safety

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • java
    • None
    • Reviewed

    Description

      Jon Hsieh pointed out that ReflectDatumWriter always returned a DatumWriter<Object>, though it's often clear (by the way the schema is constructed) that there's a more specific type that could be used. In the quote below, the second line would be preferable to the third.

        Schema schema = reflectData.getSchema(MyObject.class);
        // DatumWriter<MyObject> writer = new ReflectDatumWriter(schema);
        DatumWriter<Object> writer = new ReflectDatumWriter(schema);
      

      Attachments

        1. AVRO-298.patch.txt
          20 kB
          Philip Martin

        Activity

          People

            philip Philip Martin
            philip Philip Martin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: