[ 
https://issues.apache.org/jira/browse/HBASE-9359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13752906#comment-13752906
 ] 

Jonathan Hsieh commented on HBASE-9359:
---------------------------------------

Yup, I'm pretty convinced that preGet and postGet must be List<Cell> and not 
List<? extends Cell>.  If we have it as a List<? extends Cell> we get into 
co/contra variance problems -- we can read the elements out of the list, but 
when we cannot put things in in a typesafe way. 

Suppose we don't know if the list is List<KeyValue> or List<Cell> (the case 
with  <? extends Cell>),  Lets say it was actually a List<KeyValue> and we were 
able to put in some non KeyValue derived Cell.  The calling code, knowing the 
list is a List<KeyValue> would attempt to read values out of the list and and 
interpret them as KeyValue.  This would be a type error causing runtime barf 
since it was some other Cell.  

By having it as a List<Cell> we can read and write in elements that are 
subclasses of Cell as long as we only use the Cell interface.  
                
> Convert KeyValue to Cell in hbase-client module - Result/Put/Delete, 
> ColumnInterpreter
> --------------------------------------------------------------------------------------
>
>                 Key: HBASE-9359
>                 URL: https://issues.apache.org/jira/browse/HBASE-9359
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Client
>    Affects Versions: 0.95.2
>            Reporter: Jonathan Hsieh
>            Assignee: Jonathan Hsieh
>         Attachments: hbase-9359.patch
>
>
> This path is the second half of eliminating KeyValue from the client 
> interfaces.  This percolated through quite a bit. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to