ICU-8210 Fixed compiler warnings and JavaDoc warnings.
X-SVN-Rev: 29544
This commit is contained in:
parent
fd8dda0f61
commit
8f2a1ed97c
@ -727,6 +727,7 @@ public abstract class CharsetDecoderICU extends CharsetDecoder{
|
||||
* Returns the maxBytesPerChar value for the Charset that created this decoder.
|
||||
* @return maxBytesPerChar
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public final float maxBytesPerChar() {
|
||||
return ((CharsetICU)(this.charset())).maxBytesPerChar;
|
||||
@ -737,6 +738,7 @@ public abstract class CharsetDecoderICU extends CharsetDecoder{
|
||||
* 16-bit char/UChar (e.g. converters that are SBCS or DBCS).
|
||||
* @return true if the converter is fixed-width
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public final boolean isFixedWidth() {
|
||||
return ((CharsetICU)this.charset()).isFixedWidth();
|
||||
|
@ -922,6 +922,7 @@ public abstract class CharsetEncoderICU extends CharsetEncoder {
|
||||
* Returns the maxCharsPerByte value for the Charset that created this encoder.
|
||||
* @return maxCharsPerByte
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public final float maxCharsPerByte() {
|
||||
return ((CharsetICU)(this.charset())).maxCharsPerByte;
|
||||
@ -932,6 +933,7 @@ public abstract class CharsetEncoderICU extends CharsetEncoder {
|
||||
* 16-bit char/UChar (e.g. converters that are SBCS or DBCS).
|
||||
* @return true if the converter is fixed-width
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public final boolean isFixedWidth() {
|
||||
return ((CharsetICU)this.charset()).isFixedWidth();
|
||||
|
@ -1,12 +1,11 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2010-2011, Google, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
********************************************************************************
|
||||
* Copyright (C) 2010-2011, Google, International Business Machines Corporation *
|
||||
* and others. All Rights Reserved. *
|
||||
********************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.lang;
|
||||
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
|
||||
/**
|
||||
* A number of utilities for dealing with CharSequences and related classes.
|
||||
@ -22,6 +21,7 @@ import com.ibm.icu.text.UnicodeSet;
|
||||
* </ul>
|
||||
* @author markdavis
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public class CharSequences {
|
||||
// TODO
|
||||
@ -29,20 +29,22 @@ public class CharSequences {
|
||||
// compareToIgnoreCase(a, b)
|
||||
// contentEquals(a, b)
|
||||
// contentEqualsIgnoreCase(a, b)
|
||||
|
||||
|
||||
// contains(a, b) => indexOf >= 0
|
||||
// endsWith(a, b)
|
||||
// startsWith(a, b)
|
||||
|
||||
|
||||
// lastIndexOf(a, b, fromIndex)
|
||||
// indexOf(a, ch, fromIndex)
|
||||
// lastIndexOf(a, ch, fromIndex);
|
||||
|
||||
// s.trim() => UnicodeSet.trim(CharSequence s); return a subsequence starting with the first character not in the set to the last character not in the set.
|
||||
// add UnicodeSet.split(CharSequence s);
|
||||
|
||||
|
||||
/**
|
||||
* Find the longest n such that a[aIndex,n] = b[bIndex,n], and n is on a character boundary.
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int matchAfter(CharSequence a, CharSequence b, int aIndex, int bIndex) {
|
||||
int i = aIndex, j = bIndex;
|
||||
@ -65,6 +67,8 @@ public class CharSequences {
|
||||
|
||||
/**
|
||||
* Count the code point length. Unpaired surrogates count as 1.
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public int codePointLength(CharSequence s) {
|
||||
return Character.codePointCount(s, 0, s.length());
|
||||
@ -85,10 +89,8 @@ public class CharSequences {
|
||||
* Utility function for comparing codepoint to string without generating new
|
||||
* string.
|
||||
*
|
||||
* @param codepoint
|
||||
* @param other
|
||||
* @return true if the codepoint equals the string
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static final boolean equals(int codepoint, CharSequence other) {
|
||||
if (other == null) {
|
||||
@ -100,7 +102,11 @@ public class CharSequences {
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static final boolean equals(CharSequence other, int codepoint) {
|
||||
return equals(codepoint, other);
|
||||
}
|
||||
@ -111,6 +117,9 @@ public class CharSequences {
|
||||
* and comparing, but much faster (no object creation).
|
||||
* Actually, there is one difference; a null compares as less.
|
||||
* Note that this (=String) order is UTF-16 order -- *not* code point order.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int compare(CharSequence string, int codePoint) {
|
||||
if (codePoint < Character.MIN_CODE_POINT || codePoint > Character.MAX_CODE_POINT) {
|
||||
@ -151,6 +160,9 @@ public class CharSequences {
|
||||
* Same results as turning the code point into a string and comparing, but much faster (no object creation).
|
||||
* Actually, there is one difference; a null compares as less.
|
||||
* Note that this (=String) order is UTF-16 order -- *not* code point order.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int compare(int codepoint, CharSequence a) {
|
||||
return -compare(a, codepoint);
|
||||
@ -158,6 +170,7 @@ public class CharSequences {
|
||||
|
||||
/**
|
||||
* Return the value of the first code point, if the string is exactly one code point. Otherwise return Integer.MAX_VALUE.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@ -173,7 +186,9 @@ public class CharSequences {
|
||||
/**
|
||||
* Utility function for comparing objects that may be null
|
||||
* string.
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static final <T extends Object> boolean equals(T a, T b) {
|
||||
return a == null ? b == null
|
||||
@ -183,7 +198,9 @@ public class CharSequences {
|
||||
|
||||
/**
|
||||
* Utility for comparing the contents of CharSequences
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int compare(CharSequence a, CharSequence b) {
|
||||
int alength = a.length();
|
||||
@ -200,15 +217,20 @@ public class CharSequences {
|
||||
|
||||
/**
|
||||
* Utility for comparing the contents of CharSequences
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static boolean equalsChars(CharSequence a, CharSequence b) {
|
||||
// do length test first for fast path
|
||||
return a.length() == b.length() && compare(a,b) == 0;
|
||||
}
|
||||
|
||||
/** Are we on a character boundary?
|
||||
/**
|
||||
* Are we on a character boundary?
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static boolean onCharacterBoundary(CharSequence s, int i) {
|
||||
return i <= 0
|
||||
@ -216,13 +238,12 @@ public class CharSequences {
|
||||
|| !Character.isHighSurrogate(s.charAt(i-1))
|
||||
|| !Character.isLowSurrogate(s.charAt(i));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find code point in string.
|
||||
* @param s
|
||||
* @param codePoint
|
||||
* @return
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int indexOf(CharSequence s, int codePoint) {
|
||||
int cp;
|
||||
@ -242,7 +263,9 @@ public class CharSequences {
|
||||
* doSomethingWith(codePoint);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public static int[] codePoints(CharSequence s) {
|
||||
int[] result = new int[s.length()]; // in the vast majority of cases, the length is the same
|
||||
@ -265,4 +288,7 @@ public class CharSequences {
|
||||
System.arraycopy(result, 0, shortResult, 0, j);
|
||||
return shortResult;
|
||||
}
|
||||
|
||||
private CharSequences() {
|
||||
}
|
||||
}
|
||||
|
@ -786,6 +786,7 @@ public class PluralRules implements Serializable {
|
||||
* @param keyword the keyword to check for a unique value
|
||||
* @return The unique value for the keyword, or NO_UNIQUE_VALUE.
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public double getUniqueKeywordValue(String keyword) {
|
||||
if (uniqueKeywordValues == null) {
|
||||
@ -820,6 +821,7 @@ public class PluralRules implements Serializable {
|
||||
* @param keyword the keyword to test
|
||||
* @return a list of values matching the keyword.
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public Collection<Double> getSamples(String keyword) {
|
||||
if (!keywords.contains(keyword)) {
|
||||
|
@ -275,11 +275,13 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
/**
|
||||
* Constant for the empty set.
|
||||
* @draft 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static final UnicodeSet EMPTY = new UnicodeSet().freeze();
|
||||
/**
|
||||
* Constant for the set of all code points. (Since UnicodeSets can include strings, does not include everything that a UnicodeSet can.)
|
||||
* @draft 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static final UnicodeSet ALL_CODE_POINTS = new UnicodeSet(0, 0x10FFFF).freeze();
|
||||
|
||||
|
@ -607,7 +607,7 @@ public final class BytesTrie implements Cloneable, Iterable<BytesTrie.Entry> {
|
||||
* In this case, this "not a real value" is indistinguishable from
|
||||
* a real value of -1.
|
||||
* @return An Entry with the string and value of the next element.
|
||||
* @throw NoSuchElementException - iteration has no more elements.
|
||||
* @throws NoSuchElementException - iteration has no more elements.
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
|
@ -511,7 +511,7 @@ public final class CharsTrie implements Cloneable, Iterable<CharsTrie.Entry> {
|
||||
* In this case, this "not a real value" is indistinguishable from
|
||||
* a real value of -1.
|
||||
* @return An Entry with the string and value of the next element.
|
||||
* @throw NoSuchElementException - iteration has no more elements.
|
||||
* @throws NoSuchElementException - iteration has no more elements.
|
||||
* @draft ICU 4.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
|
@ -1646,7 +1646,7 @@ public abstract class Transliterator implements StringTransform {
|
||||
// the high-runner case.
|
||||
UnicodeSet temp;
|
||||
try {
|
||||
temp = (UnicodeSet) filter;
|
||||
temp = filter;
|
||||
} catch (ClassCastException e) {
|
||||
filter.addMatchSetTo(temp = new UnicodeSet());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2008-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 2008-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -211,6 +211,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
||||
AlphabeticIndex<String> alphabeticIndex = new AlphabeticIndex(locale);
|
||||
alphabeticIndex.addRecord("hi", "HI");
|
||||
for (Bucket<String> bucket : alphabeticIndex) {
|
||||
@SuppressWarnings("unused")
|
||||
LabelType labelType = bucket.getLabelType();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2005-2010, International Business Machines
|
||||
* Copyright (c) 2005-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -596,14 +596,12 @@ public class MessageRegression extends com.ibm.icu.dev.test.TestFmwk {
|
||||
*/
|
||||
public void Test4169959() {
|
||||
// This works
|
||||
logln(MessageFormat.format( "This will {0}",
|
||||
new String[]{"work"} ) );
|
||||
|
||||
logln(MessageFormat.format("This will {0}", "work"));
|
||||
|
||||
// This fails
|
||||
logln(MessageFormat.format( "This will {0}",
|
||||
new Object[]{ null } ) );
|
||||
logln(MessageFormat.format("This will {0}", new Object[]{ null }));
|
||||
}
|
||||
|
||||
|
||||
public void test4232154() {
|
||||
boolean gotException = false;
|
||||
try {
|
||||
|
@ -18,15 +18,14 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.impl.CurrencyData;
|
||||
import com.ibm.icu.text.CurrencyDisplayNames;
|
||||
import com.ibm.icu.text.CurrencyMetaInfo;
|
||||
import com.ibm.icu.text.DecimalFormatSymbols;
|
||||
import com.ibm.icu.util.Currency;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.text.CurrencyMetaInfo;
|
||||
import com.ibm.icu.text.CurrencyDisplayNames;
|
||||
import com.ibm.icu.impl.CurrencyData;
|
||||
|
||||
/**
|
||||
* @test
|
||||
|
@ -149,6 +149,7 @@ public class TrieMapTest extends TestFmwk {
|
||||
timeIteration(unicodeTestMap, comparisonTime, Style.CHARS, 3);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public long timeIteration(Map<String, Integer> testMap, long comparisonTime, Style style, double ratioToMap) {
|
||||
TrieMap<Integer> trieMap = TrieMap.BytesBuilder.with(style, Option.SMALL, testMap).build();
|
||||
TreeMap<String,Integer> expected = new TreeMap<String, Integer>(testMap);
|
||||
@ -285,10 +286,8 @@ public class TrieMapTest extends TestFmwk {
|
||||
timeBuilding(unicodeTestMap, comparisonTime, Style.CHARS, Option.FAST, 20);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public long timeBuilding(Map<String, Integer> testmap, long comparisonTime, Style style, Option option, double ratioToMap) {
|
||||
TrieMap<Integer> trieMap = null;
|
||||
TreeMap<String, Integer> map = null;
|
||||
|
||||
System.gc();
|
||||
t.start();
|
||||
if (style == null) {
|
||||
@ -397,6 +396,7 @@ public class TrieMapTest extends TestFmwk {
|
||||
timeGet(keys, unicodeTestMap, comparisonTime, Style.CHARS, 3);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public long timeGet(ArrayList<String> keys, Map<String, Integer> testmap, long comparisonTime, Style style, int ratioToMap) {
|
||||
|
||||
TrieMap<Integer> trieMap = TrieMap.Builder.with(style, Option.SMALL, testmap).build();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -3016,9 +3016,10 @@ public class TransliteratorTest extends TestFmwk {
|
||||
public void TestSourceTargetSet2() {
|
||||
|
||||
|
||||
Normalizer2 nfkd = Normalizer2.getInstance(null, "nfkc", Mode.DECOMPOSE);
|
||||
Normalizer2 nfc = Normalizer2.getInstance(null, "nfc", Mode.COMPOSE);
|
||||
Normalizer2 nfd = Normalizer2.getInstance(null, "nfc", Mode.DECOMPOSE);
|
||||
|
||||
// Normalizer2 nfkd = Normalizer2.getInstance(null, "nfkd", Mode.DECOMPOSE);
|
||||
// UnicodeSet nfkdSource = new UnicodeSet();
|
||||
// UnicodeSet nfkdTarget = new UnicodeSet();
|
||||
// for (int i = 0; i <= 0x10FFFF; ++i) {
|
||||
@ -3308,16 +3309,16 @@ public class TransliteratorTest extends TestFmwk {
|
||||
}
|
||||
}
|
||||
|
||||
private void addDerivedStrings(Normalizer2 nfc, UnicodeSet disorderedMarks, String s) {
|
||||
disorderedMarks.add(s);
|
||||
for (int j = 1; j < s.length(); ++j) {
|
||||
if (CharSequences.onCharacterBoundary(s, j)) {
|
||||
String shorter = s.substring(0,j);
|
||||
disorderedMarks.add(shorter);
|
||||
disorderedMarks.add(nfc.normalize(shorter) + s.substring(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
// private void addDerivedStrings(Normalizer2 nfc, UnicodeSet disorderedMarks, String s) {
|
||||
// disorderedMarks.add(s);
|
||||
// for (int j = 1; j < s.length(); ++j) {
|
||||
// if (CharSequences.onCharacterBoundary(s, j)) {
|
||||
// String shorter = s.substring(0,j);
|
||||
// disorderedMarks.add(shorter);
|
||||
// disorderedMarks.add(nfc.normalize(shorter) + s.substring(j));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void TestCharUtils() {
|
||||
String[][] startTests = {
|
||||
|
Loading…
Reference in New Issue
Block a user