[
https://issues.apache.org/jira/browse/HBASE-13273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14368881#comment-14368881
]
Lars George commented on HBASE-13273:
-------------------------------------
I do not think this is enough. You can still call {{addResults()}} (or
{{addStats()}} soon), and {{setExists()}}, modifying the EMPTY_RESULT.
What we really need is either the interface idea suggested by [~ndimiduk] or
some more coding to make a Result "read-only". I mean, we could have an package
local constructor that sets a {{boolean readonly}} to {{true}} and then all
setters respecting that. This will not break the signature and is better than
doing the {{copyfrom()}} kludge.
So I am -1 until convinced otherwise.
> Make Result.EMPTY_RESULT read-only; currently it can be modified
> ----------------------------------------------------------------
>
> Key: HBASE-13273
> URL: https://issues.apache.org/jira/browse/HBASE-13273
> Project: HBase
> Issue Type: Bug
> Affects Versions: 0.98.0, 1.0.0
> Reporter: stack
> Assignee: Mikhail Antonov
> Labels: beginner
> Fix For: 2.0.0, 1.0.1, 1.1.0, 0.98.13
>
> Attachments: HBASE-13273.patch, HBASE-13273.patch, HBASE-13273.patch
>
>
> Again from [~larsgeorge]
> Result result2 = Result.EMPTY_RESULT;
> System.out.println(result2);
> result2.copyFrom(result1);
> System.out.println(result2);
> "What do you think happens when result1 has cells? Yep, you just modified the
> shared public EMPTY_RESULT to be not empty anymore."
> Fix. Result should be non-modifiable post-construction.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)