hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo (Nicholas), SZE (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (HADOOP-3048) Stringifier
Date Thu, 20 Mar 2008 21:31:24 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-3048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580916#action_12580916
] 

szetszwo edited comment on HADOOP-3048 at 3/20/08 2:31 PM:
-------------------------------------------------------------------------

> Well i guess not. The warnings result from obj.getClass() function returning Class<?
extends X>} where X is the erasure of the static type of the expression on which getClass
is called. If you can find a better way of not causing warnings i would gladly accept that.

+1: It seems to me that there is no way to do t.getClass() for generic t without a unchecked
warning.  i.e.
{code}
T t = ...;
Class<XXX> c = t.getClass(); //there will be a unchecked warning, no matter XXX is (or
it does not compile).
{code}

I have the following suggestions:
- Only add @SuppressWarnings("unchecked") right before the required statements but not before
the entire method.

- Create a static getClass(T) as following:
{code}
static public <T> Class<T> getClass(T t) {
    @SuppressWarnings("unchecked")
    Class<T> clazz = (Class<T>)t.getClass();
    return clazz;
}
{code}
Use getClass(t) instead of t.getClass().  Then, I guess we only need to add one @SuppressWarnings("unchecked")
tag.

      was (Author: szetszwo):
    > Well i guess not. The warnings result from obj.getClass() function returning Class<?
extends X>} where X is the erasure of the static type of the expression on which getClass
is called. If you can find a better way of not causing warnings i would gladly accept that.

It seems to me that there is no way to do t.getClass() for generic t without a unchecked warning.
 i.e.
{code}
T t = ...;
Class<XXX> c = t.getClass(); //there will be a unchecked warning, no matter XXX is (or
it dose not compile).
{code}

I have the following suggestions:
- Only add @SuppressWarnings("unchecked") right behind the required statements but not behind
the entire method.

- Create a static getClass(T) as following:
{code}
static public <T> Class<T> getClass(T t) {
    @SuppressWarnings("unchecked")
    Class<T> clazz = (Class<T>)t.getClass();
    return clazz;
}
{code}
Use getClass(t) instead of t.getClass().  Then, I guess we only need to add one @SuppressWarnings("unchecked")
tag.
  
> Stringifier
> -----------
>
>                 Key: HADOOP-3048
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3048
>             Project: Hadoop Core
>          Issue Type: New Feature
>    Affects Versions: 0.17.0
>            Reporter: Enis Soztutar
>            Assignee: Enis Soztutar
>             Fix For: 0.17.0
>
>         Attachments: stringifier_v1.patch, stringifier_v2.patch, stringifier_v3.patch
>
>
> Storing arbitrary objects in the configuration has been discussed before in HADOOP-449
and HADOOP-1873. Although enabling such functionality has the risk of encouraging people to
put big binary objects in the configuration, for some use cases passing objects to tasks is
absolutely necessary. 
> This issue will track the implementation of a Stringifier interface which stringifies
and destringifies objects. Using this implementation, developers can store objects in the
configuration and restore them later. 
> Any thoughts ?

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


Mime
View raw message