From 527161ff5aa9bf50e44f04cbd27344efd8a073d0 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Wed, 15 Aug 2012 17:09:39 +0000 Subject: [PATCH] ICU-9406 deprecate isHiraganaQuaternary(), setHiraganaQuaternary(boolean flag) and setHiraganaQuaternaryDefault(), disable the setters (merged from branches/markus/uni62 r32109, should not have been on that branch) X-SVN-Rev: 32176 --- .../com/ibm/icu/text/RuleBasedCollator.java | 27 ++++++++++++------- .../dev/test/collator/CollationAPITest.java | 8 +++--- .../dev/test/collator/CollationKanaTest.java | 7 +++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/icu4j/main/classes/collate/src/com/ibm/icu/text/RuleBasedCollator.java b/icu4j/main/classes/collate/src/com/ibm/icu/text/RuleBasedCollator.java index 4b2fa8d9181..d230b506523 100644 --- a/icu4j/main/classes/collate/src/com/ibm/icu/text/RuleBasedCollator.java +++ b/icu4j/main/classes/collate/src/com/ibm/icu/text/RuleBasedCollator.java @@ -327,37 +327,41 @@ public final class RuleBasedCollator extends Collator { * Sets the Hiragana Quaternary mode to be on or off. When the Hiragana Quaternary mode is turned on, the collator * positions Hiragana characters before all non-ignorable characters in QUATERNARY strength. This is to produce a * correct JIS collation order, distinguishing between Katakana and Hiragana characters. + * + * This attribute is an implementation detail of the CLDR Japanese tailoring. + * The implementation might change to use a different mechanism + * to achieve the same Japanese sort order. + * Since ICU 50, this attribute is not settable any more via API functions. * * @param flag * true if Hiragana Quaternary mode is to be on, false otherwise * @see #setHiraganaQuaternaryDefault * @see #isHiraganaQuaternary - * @stable ICU 2.8 + * @deprecated ICU 50 Implementation detail, cannot be set via API, might be removed from implementation. */ public void setHiraganaQuaternary(boolean flag) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify frozen object"); } - - m_isHiragana4_ = flag; - updateInternalState(); } /** * Sets the Hiragana Quaternary mode to the initial mode set during construction of the RuleBasedCollator. See * setHiraganaQuaternary(boolean) for more details. + * + * This attribute is an implementation detail of the CLDR Japanese tailoring. + * The implementation might change to use a different mechanism + * to achieve the same Japanese sort order. + * Since ICU 50, this attribute is not settable any more via API functions. * * @see #setHiraganaQuaternary(boolean) * @see #isHiraganaQuaternary - * @stable ICU 2.8 + * @deprecated ICU 50 Implementation detail, cannot be set via API, might be removed from implementation. */ public void setHiraganaQuaternaryDefault() { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify frozen object"); } - - m_isHiragana4_ = m_defaultIsHiragana4_; - updateInternalState(); } /** @@ -1187,11 +1191,16 @@ public final class RuleBasedCollator extends Collator { /** * Checks if the Hiragana Quaternary mode is set on. See setHiraganaQuaternary(boolean) for more details. + * + * This attribute is an implementation detail of the CLDR Japanese tailoring. + * The implementation might change to use a different mechanism + * to achieve the same Japanese sort order. + * Since ICU 50, this attribute is not settable any more via API functions. * * @return flag true if Hiragana Quaternary mode is on, false otherwise * @see #setHiraganaQuaternaryDefault * @see #setHiraganaQuaternary(boolean) - * @stable ICU 2.8 + * @deprecated ICU 50 Implementation detail, cannot be set via API, might be removed from implementation. */ public boolean isHiraganaQuaternary() { return m_isHiragana4_; diff --git a/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationAPITest.java b/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationAPITest.java index 6b6cb63e7ad..75c37ae3dae 100644 --- a/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationAPITest.java +++ b/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationAPITest.java @@ -1,7 +1,7 @@ /* ******************************************************************************* - * Copyright (C) 2002-2011, International Business Machines Corporation and * - * others. All Rights Reserved. * + * Copyright (C) 2002-2012, International Business Machines Corporation and + * others. All Rights Reserved. ******************************************************************************* */ @@ -830,8 +830,8 @@ public class CollationAPITest extends TestFmwk { errln("Setting french collation failed"); } collator.setHiraganaQuaternary(!hquart); - if (collator.isHiraganaQuaternary() == hquart) { - errln("Setting hiragana quartenary failed"); + if (collator.isHiraganaQuaternary() != hquart) { + errln("Setting hiragana quartenary worked but should be a no-op since ICU 50"); } collator.setLowerCaseFirst(!lowercase); if (collator.isLowerCaseFirst() == lowercase) { diff --git a/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationKanaTest.java b/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationKanaTest.java index 79753056868..76b373f2510 100644 --- a/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationKanaTest.java +++ b/icu4j/main/tests/collate/src/com/ibm/icu/dev/test/collator/CollationKanaTest.java @@ -1,7 +1,7 @@ /* ******************************************************************************* - * Copyright (C) 2002-2010, International Business Machines Corporation and * - * others. All Rights Reserved. * + * Copyright (C) 2002-2012, International Business Machines Corporation and + * others. All Rights Reserved. ******************************************************************************* */ @@ -172,8 +172,7 @@ public class CollationKanaTest extends TestFmwk{ int result; String string1 = new String(tmp1); String string2 = new String(tmp2); - RuleBasedCollator rb = (RuleBasedCollator)Collator.getInstance(ULocale.JAPAN); - rb.setHiraganaQuaternary(true); + RuleBasedCollator rb = (RuleBasedCollator)Collator.getInstance(ULocale.JAPANESE); rb.setStrength(Collator.QUATERNARY); rb.setAlternateHandlingShifted(false);