incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: [jira] [Commented] (DIRECTMEMORY-43) Cache should allow key objects instead of plain string
Date Sat, 18 Feb 2012 15:12:09 GMT
there is a reason why I adopted it: Pointer contains the stored Class
type reference, so having the generic there, helps on avoiding
unneeded and useless casts and SuppressWarnings - indeed, type are
enforced at higher level, so why casting?

best,
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Sat, Feb 18, 2012 at 2:54 PM, Michael André Pearce
<michael.andre.pearce@me.com> wrote:
> Also to note, there is no need to make your pointer generic (this can be sorted at a
later date), as a user of the cache the generics enforce what goes in and out the cache.
>
>
> On 18 Feb 2012, at 13:53, Michael André Pearce wrote:
>
>> Simon,
>>
>> Taking your Cache<String,String>
>>
>> So K = String, and V = String therefor ptr.clazz would = String not ByteBuffer ,
java.lang.String doesn't extend ByteBuffer, thus this code would execute.
>>
>>
>> Mike
>>
>>
>> On 18 Feb 2012, at 13:40, Simone Tripodi (Commented) (JIRA) wrote:
>>
>>>
>>>   [ https://issues.apache.org/jira/browse/DIRECTMEMORY-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13210943#comment-13210943
]
>>>
>>> Simone Tripodi commented on DIRECTMEMORY-43:
>>> --------------------------------------------
>>>
>>> Michael, I had a deep review in the code, and IIUC, we can have a {{Cache<String,
String>}}, that would mean:
>>>
>>> {code}
>>> @@ -214,11 +214,11 @@
>>>            if ( ptr.clazz == ByteBuffer.class )
>>>            {
>>>                // skip serialization if it is a bytebuffer
>>> - return ptr.directBuffer;
>>> + return (String) ptr.directBuffer;
>>>            }
>>> {code}
>>>
>>> that is not correct
>>>
>>>> Cache should allow key objects instead of plain string
>>>> ------------------------------------------------------
>>>>
>>>>               Key: DIRECTMEMORY-43
>>>>               URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-43
>>>>           Project: Apache DirectMemory
>>>>        Issue Type: Improvement
>>>>          Reporter: Maurizio Cucchiara
>>>>          Assignee: Maurizio Cucchiara
>>>>       Attachments: DIRECTMEMORY-43.patch, DIRECTMEMORY-43_wider-type-inference_NOT-WORKING.patch,
patch.org.apache.directmemory.cache.zip
>>>>
>>>>
>>>> See http://goo.gl/D4SRN
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
>>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>>
>>>
>>
>

Mime
View raw message