Hi! In this patch, private getLocaleInternal() and Locale(String,String,String,int hashcode) (the later just creates an instance with the given parameters) are introduced and used through out the class (where possible) - so, no string interning is involved during Locale consts initialization (except for "defaultLocale" which is set late) and on cloning (plus no unnecessary string conversions).
Also, a bug in getAvailableLocales() is fixed.
ChangeLog entries:
* java/util/Locale.java:
(localeMap): Immediately define its value; make it final; use generics
for HashMap type; move localeMap definition to the beginning of the
class (to be initialized first); update the comment.
(ENGLISH): Call getLocaleInternal() instead of getLocale() (for
efficiency).
(FRENCH): Likewise.
(GERMAN): Likewise.
(ITALIAN): Likewise.
(JAPANESE): Likewise.
(KOREAN): Likewise.
(CHINESE): Likewise.
(SIMPLIFIED_CHINESE): Likewise.
(TRADITIONAL_CHINESE): Likewise.
(FRANCE): Likewise.
(GERMANY): Likewise.
(ITALY): Likewise.
(JAPAN): Likewise.
(KOREA): Likewise.
(UK): Likewise.
(US): Likewise.
(CANADA): Likewise.
(CANADA_FRENCH): Likewise.
(ROOT): Call private 4-argument constructor (with the hash code)
instead of the 3-argument one (for efficiency).
(clone()): Likewise.
(getLocale(String,String,String)): Remove localeMap initialization;
remove localeMap.get() result casting.
(getLocaleInternal(String,String)): New private method (for
convenience since it is always called with unset "variant").
(getLocaleInternal(String,String,String)): New private method (same as
getLocale() but with the additional constraints for the arguments).
(Locale(String,String,String,int)): New private constructor
(used only by ROOT, getLocaleInternal() and clone()).
(getAvailableLocales()): Fix "country" computation expression (for
the case when "variant" is specified).
Regards.
classpath-ivmai-32.diff
Description: Binary data
