Update Locale to OpenJDK8u60, part 2
This CL adds APIs for RFC 4647 Matching of Language Tags.
Assertions in added tests are a combination of current
behavior and examples from RFC 4647.
Notes:
* The upstream code has a bug where calling LocaleMatcher.parse()
modifies values of static final LocaleEquivalentMaps.multiEquivsMap.
This bug has already been reported upstream at
https://bugs.openjdk.java.net/browse/JDK-8166994
The upstream fix will be applied along with suitable tests in
a follow-up CL.
* Locale.filterTag() and Locale.lookupTag*() tends to return
lowerCase versions of the tags supplied, except when the
priority list of LanguageRanges contains a "*" or similar.
For now, LocaleTest lowerCases all tags (via tagsOf()) so that
the test can pass. I plan to submit a patch / proposal to
upstream to preserve case of the given tags, at which point
the test could be made more opinionated.
* The hard coded mapping of equivalent locales in
LocaleEquivalentMaps comes from an unknown source. It doesn't
appear to be present in ICU so this CL is taking the upstream
mapping for now.
* Notwithstanding the comments above, the code added to
Locale.java, LocaleEquivalentMaps.java and LocaleMatcher.java
in this CL exactly matches upstream OpenJDK8u60. No attempt
has been made to make this code cleaner / more robust in this
CL.
Bug: 29935305
Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a
Change-Id: Ie86477b8eea1f5f3d69d4f161628847793d372fd
6 files changed