[
https://issues.apache.org/jira/browse/PHOENIX-7579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17944679#comment-17944679
]
Istvan Toth commented on PHOENIX-7579:
--------------------------------------
Thanks for the heads up and the tips for dealing with the change,
[~mnita_2000] .
> ICU4J Will drop icu4j-localespi in next release
> -----------------------------------------------
>
> Key: PHOENIX-7579
> URL: https://issues.apache.org/jira/browse/PHOENIX-7579
> Project: Phoenix
> Issue Type: Task
> Components: core
> Reporter: Mihai Nita
> Priority: Major
>
> _"WARNING: Please note that for ICU 78 (2025-oct) we are planning to remove
> the ICU4J Locale Service Provider. See the ICU 77 page for details."_
> [https://unicode-org.github.io/icu/userguide/icu4j/locale-service-provider.html]
> —
> I am part of the ICU team, and this is a {_}"courtesy ticket"{_}.
> It looks like the only thing used from {{icu4j-localespi}} is the
> {{com.ibm.icu.impl.jdkadapter.CollatorICU}} class, not the Locale Service
> Provider mechanism.
> See
> [https://github.com/apache/phoenix/blob/master/phoenix-core-client/src/main/java/org/apache/phoenix/util/i18n/LinguisticSort.java#L522]
> The easiest fix is to make the collator a {{Comparator<Object>}} which both
> the ICU4J and the JDK {{{}Collator{}}}(s) implement.
> And change the initialization to something like this:
> {code:java}
> // Line 416
> private final Comparator<Object> collator;
> // ...
> // ...
> // Line 520
> if (LinguisticSort.Icu4jCollatorOverrides.OVERRIDES.containsKey(this.locale))
> {
> // Force ICU4J collators for specific locales so they match Oracle sort
> com.ibm.icu.text.Collator icuCollator =
> com.ibm.icu.text.Collator.getInstance(
> LinguisticSort
> .Icu4jCollatorOverrides.OVERRIDES.get(this.locale));
> icuCollator.setStrength(com.ibm.icu.text.Collator.SECONDARY);
> this.collator = icuCollator.freeze();
> } else if (this.locale.getVariant().isEmpty()) {
> // If there's a variant, use ICU4J to figure it out.
> com.ibm.icu.text.Collator icuCollator =
> com.ibm.icu.text.Collator.getInstance(
> ULocale.forLocale(this.locale)));
> icuCollator.setStrength(com.ibm.icu.text.Collator.SECONDARY);
> this.collator = icuCollator.freeze();
> } else {
> Collator jdkCollator = Collator.getInstance(this.locale);
> jdkCollator.setStrength(Collator.SECONDARY);
> this.collator = jdkCollator;
> }{code}
> Thank you,
> Mihai
--
This message was sent by Atlassian Jira
(v8.20.10#820010)