[loc-en-dev] Locale.clone()

Yoshito Umaoka y.umaoka at gmail.com
Tue Aug 31 07:46:29 PDT 2010


OK. Although I cannot imagine any real use cases which will be broken by 
such change, this is irrelevant to our goals.
Therefore, I'll leave it as is. Instead, we may open a bug for this and 
discuss about it separately.

-Yoshito

Naoto Sato wrote:
> I agree that Locale object is immutable and implementing Cloneable 
> sounds wrong in the first place, I am not so sure we could change it 
> this time. Here is the javadoc description from Object.clone():
>
> ---
> The general intent is that, for any object x, the expression:
>
>      x.clone() != x
>
> will be true, and that the expression:
>
>      x.clone().getClass() == x.getClass()
>
> will be true, but these are not absolute requirements.
> ---
>
> Although it says that x.clone() != x is not an absolute requirement, 
> Locale has been adopting this since beginning (I believe) so some apps 
> could rely on it. So unless there is a strong reason to change this 
> behavior, I would just leave as it is.
>
> Naoto
>
>
> On 8/30/10 7:28 PM, Yoshito Umaoka wrote:
>> Hi all,
>>
>> An instance of Locale is immutable. Therefore, you do not need clone().
>> For now, Locale.clone() calls super.clone() - but I do not think this is
>> actually necessary.
>> I think Locale.clone() should be just { return this; }.
>>
>> What do you think? Any objections?
>>
>> -Yoshito
>
>



More information about the locale-enhancement-dev mailing list