You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Philip Zeyliger (JIRA)" <ji...@apache.org> on 2010/01/09 01:50:54 UTC

[jira] Created: (AVRO-298) Dynamic and Specific APIs could be generified for better type safety

Dynamic and Specific APIs could be generified for better type safety
--------------------------------------------------------------------

                 Key: AVRO-298
                 URL: https://issues.apache.org/jira/browse/AVRO-298
             Project: Avro
          Issue Type: Improvement
          Components: java
            Reporter: Philip Zeyliger
            Assignee: Philip Zeyliger


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.

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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AVRO-298) Dynamic and Specific APIs could be generified for better type safety

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting resolved AVRO-298.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0
     Hadoop Flags: [Reviewed]

> Dynamic and Specific APIs could be generified for better type safety
> --------------------------------------------------------------------
>
>                 Key: AVRO-298
>                 URL: https://issues.apache.org/jira/browse/AVRO-298
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>             Fix For: 1.3.0
>
>         Attachments: AVRO-298.patch.txt
>
>
> 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.
> {noformat}
>   Schema schema = reflectData.getSchema(MyObject.class);
>   // DatumWriter<MyObject> writer = new ReflectDatumWriter(schema);
>   DatumWriter<Object> writer = new ReflectDatumWriter(schema);
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-298) Dynamic and Specific APIs could be generified for better type safety

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philip Zeyliger updated AVRO-298:
---------------------------------

    Attachment: AVRO-298.patch.txt

Attaching a patch which adds generics to {Specific,Reflect}Datum{ReaderWriter}.  If the DatumWriter interface is parameterized, as it is, this seems like the right thing.  My test for this was iterating until "ant clean compile-java compile-test-java" didn't show any warnings; the type-erased code is identical, I believe.

I suspect that the Requestor hierarchy might need similar treatment, but one at at time.

> Dynamic and Specific APIs could be generified for better type safety
> --------------------------------------------------------------------
>
>                 Key: AVRO-298
>                 URL: https://issues.apache.org/jira/browse/AVRO-298
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Philip Zeyliger
>            Assignee: Philip Zeyliger
>         Attachments: AVRO-298.patch.txt
>
>
> 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.
> {noformat}
>   Schema schema = reflectData.getSchema(MyObject.class);
>   // DatumWriter<MyObject> writer = new ReflectDatumWriter(schema);
>   DatumWriter<Object> writer = new ReflectDatumWriter(schema);
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.