mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-06 05:55:35 +00:00
ICU-12716 Corrected API comment for newly added hashCode() methods, added a test case for VersionInfo#hashCode() and updated coverage-exclusion.txt. Also updated the API change report and API signature file.
X-SVN-Rev: 39394
This commit is contained in:
parent
e3624ee74a
commit
c97eed26e6
6 changed files with 74 additions and 42 deletions
|
@ -276,6 +276,10 @@ ChineseDateFormatSymbols
|
|||
<ul>
|
||||
<li><span style='color:gray'>(deprecated)</span> protected void <i>initializeData</i>(ULocale, ICUResourceBundle, java.lang.String)</li>
|
||||
</ul>
|
||||
Collator
|
||||
<ul>
|
||||
<li><span style='color:green'>(stable)</span> public int <i>hashCode</i>()</li>
|
||||
</ul>
|
||||
DecimalFormatSymbols
|
||||
<ul>
|
||||
<li><span style='color:orange'>(draft)</span> public java.lang.String <i>getDecimalSeparatorString</i>()</li>
|
||||
|
@ -345,10 +349,11 @@ MeasureUnit
|
|||
VersionInfo
|
||||
<ul>
|
||||
<li><span style='color:green'>(stable)</span> public static final VersionInfo UNICODE_9_0</li>
|
||||
<li><span style='color:green'>(stable)</span> public int <i>hashCode</i>()</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<p><i><font size="-1">Contents generated by ReportAPI tool on Wed Sep 21 15:35:29 EDT 2016<br/>© 2016 and later: Unicode, Inc. and others. License & terms of use: <a href="http://www.unicode.org/copyright.html#License">http://www.unicode.org/copyright.html#License</a></font></i></p>
|
||||
<p><i><font size="-1">Contents generated by ReportAPI tool on Thu Sep 29 06:32:57 EDT 2016<br/>© 2016 and later: Unicode, Inc. and others. License & terms of use: <a href="http://www.unicode.org/copyright.html#License">http://www.unicode.org/copyright.html#License</a></font></i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -68,6 +68,7 @@ com/ibm/icu/impl/coll/CollationIterator#equals:(Ljava/lang/Object;)Z
|
|||
com/ibm/icu/impl/coll/CollationIterator#getCE32FromBuilderData:(I)I
|
||||
com/ibm/icu/impl/coll/CollationIterator#handleGetTrailSurrogate:()C
|
||||
com/ibm/icu/impl/coll/CollationIterator#handleNextCE32:()J
|
||||
com/ibm/icu/impl/coll/CollationIterator#hashCode:()I
|
||||
com/ibm/icu/impl/coll/CollationKeys#<init>:()V
|
||||
com/ibm/icu/impl/coll/CollationKeys$SortKeyByteSink#GetRemainingCapacity:()I
|
||||
com/ibm/icu/impl/coll/CollationKeys$SortKeyByteSink#Overflowed:()Z
|
||||
|
@ -617,6 +618,7 @@ com/ibm/icu/text/CjkBreakEngine#hashCode:()I
|
|||
com/ibm/icu/text/CollationElementIterator#strengthOrder:(I)I
|
||||
com/ibm/icu/text/CollationKey$BoundMode#<init>:()V
|
||||
com/ibm/icu/text/Collator$ASCII#<init>:()V
|
||||
com/ibm/icu/text/Collator#hashCode:()I
|
||||
com/ibm/icu/text/CollatorServiceShim$CService#handleDefault:(Lcom/ibm/icu/impl/ICUService$Key;[Ljava/lang/String;)Ljava/lang/Object;
|
||||
com/ibm/icu/text/CompactDecimalDataCache#localeAndStyle:(Lcom/ibm/icu/util/ULocale;Ljava/lang/String;)Ljava/lang/String;
|
||||
com/ibm/icu/text/CompactDecimalDataCache$FormatsTableKey#valueOf:(Ljava/lang/String;)Lcom/ibm/icu/text/CompactDecimalDataCache$FormatsTableKey;
|
||||
|
|
|
@ -321,6 +321,16 @@ public abstract class Collator implements Comparator<Object>, Freezable<Collator
|
|||
return this == obj || (obj != null && getClass() == obj.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a hash code for this Collator object.
|
||||
*
|
||||
* <p>The implementation exists just for consistency with {@link #equals(Object)}
|
||||
* implementation in this class and does not generate a useful hash code.
|
||||
* Subclasses should override this implementation.
|
||||
*
|
||||
* @return a hash code value.
|
||||
* @stable ICU 58
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// Dummy return to prevent compile warnings.
|
||||
|
|
|
@ -470,7 +470,7 @@ public final class VersionInfo implements Comparable<VersionInfo>
|
|||
*
|
||||
* @return the hash code value for this set.
|
||||
* @see java.lang.Object#hashCode()
|
||||
* @stable ICU 2.0
|
||||
* @stable ICU 58
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
@ -24,10 +24,10 @@ import com.ibm.icu.util.VersionInfo;
|
|||
* @author Syn Wee Quek
|
||||
* @since release 2.1 March 01 2002
|
||||
*/
|
||||
public final class VersionInfoTest extends TestFmwk
|
||||
{
|
||||
public final class VersionInfoTest extends TestFmwk
|
||||
{
|
||||
// constructor ---------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
}
|
||||
|
||||
// public methods -----------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Test that the instantiation works
|
||||
*/
|
||||
|
@ -46,10 +46,10 @@ public final class VersionInfoTest extends TestFmwk
|
|||
for (int i = 0; i < INSTANCE_INVALID_STRING_.length; i ++) {
|
||||
try {
|
||||
VersionInfo.getInstance(INSTANCE_INVALID_STRING_[i]);
|
||||
errln("\"" + INSTANCE_INVALID_STRING_[i] +
|
||||
errln("\"" + INSTANCE_INVALID_STRING_[i] +
|
||||
"\" should produce an exception");
|
||||
} catch (RuntimeException e) {
|
||||
logln("PASS: \"" + INSTANCE_INVALID_STRING_[i] +
|
||||
logln("PASS: \"" + INSTANCE_INVALID_STRING_[i] +
|
||||
"\" failed as expected");
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
try {
|
||||
VersionInfo.getInstance(INSTANCE_VALID_STRING_[i]);
|
||||
} catch (RuntimeException e) {
|
||||
errln("\"" + INSTANCE_VALID_STRING_[i] +
|
||||
errln("\"" + INSTANCE_VALID_STRING_[i] +
|
||||
"\" should produce an valid version");
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
getInstance(INSTANCE_INVALID_INT_[i]);
|
||||
errln("invalid ints should produce an exception");
|
||||
} catch (RuntimeException e) {
|
||||
logln("PASS: \"" + Arrays.toString(INSTANCE_INVALID_INT_[i]) +
|
||||
logln("PASS: \"" + Arrays.toString(INSTANCE_INVALID_INT_[i]) +
|
||||
"\" failed as expected");
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test that the comparison works
|
||||
*/
|
||||
|
@ -86,9 +86,9 @@ public final class VersionInfoTest extends TestFmwk
|
|||
public void TestCompare()
|
||||
{
|
||||
for (int i = 0; i < COMPARE_NOT_EQUAL_STRING_.length; i += 2) {
|
||||
VersionInfo v1 =
|
||||
VersionInfo v1 =
|
||||
VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i]);
|
||||
VersionInfo v2 =
|
||||
VersionInfo v2 =
|
||||
VersionInfo.getInstance(COMPARE_NOT_EQUAL_STRING_[i + 1]);
|
||||
if (v1.compareTo(v2) == 0) {
|
||||
errln(COMPARE_NOT_EQUAL_STRING_[i] + " should not equal " +
|
||||
|
@ -104,9 +104,9 @@ public final class VersionInfoTest extends TestFmwk
|
|||
}
|
||||
}
|
||||
for (int i = 0; i < COMPARE_EQUAL_STRING_.length - 1; i ++) {
|
||||
VersionInfo v1 =
|
||||
VersionInfo v1 =
|
||||
VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i]);
|
||||
VersionInfo v2 =
|
||||
VersionInfo v2 =
|
||||
VersionInfo.getInstance(COMPARE_EQUAL_STRING_[i + 1]);
|
||||
if (v1.compareTo(v2) != 0) {
|
||||
errln(COMPARE_EQUAL_STRING_[i] + " should equal " +
|
||||
|
@ -125,16 +125,16 @@ public final class VersionInfoTest extends TestFmwk
|
|||
VersionInfo v1 = VersionInfo.getInstance(COMPARE_LESS_[i]);
|
||||
VersionInfo v2 = VersionInfo.getInstance(COMPARE_LESS_[i + 1]);
|
||||
if (v1.compareTo(v2) >= 0) {
|
||||
errln(COMPARE_LESS_[i] + " should be less than " +
|
||||
errln(COMPARE_LESS_[i] + " should be less than " +
|
||||
COMPARE_LESS_[i + 1]);
|
||||
}
|
||||
if (v2.compareTo(v1) <= 0) {
|
||||
errln(COMPARE_LESS_[i + 1] + " should be greater than " +
|
||||
errln(COMPARE_LESS_[i + 1] + " should be greater than " +
|
||||
COMPARE_LESS_[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test that the getter function works
|
||||
*/
|
||||
|
@ -147,36 +147,36 @@ public final class VersionInfoTest extends TestFmwk
|
|||
v.getMinor() != GET_RESULT_[(i << 2) + 1] ||
|
||||
v.getMilli() != GET_RESULT_[(i << 2) + 2] ||
|
||||
v.getMicro() != GET_RESULT_[(i << 2) + 3]) {
|
||||
errln(GET_STRING_[i] + " should return major=" +
|
||||
GET_RESULT_[i << 2] + " minor=" +
|
||||
GET_RESULT_[(i << 2) + 1] + " milli=" +
|
||||
errln(GET_STRING_[i] + " should return major=" +
|
||||
GET_RESULT_[i << 2] + " minor=" +
|
||||
GET_RESULT_[(i << 2) + 1] + " milli=" +
|
||||
GET_RESULT_[(i << 2) + 2] + " micro=" +
|
||||
GET_RESULT_[(i << 2) + 3]);
|
||||
GET_RESULT_[(i << 2) + 3]);
|
||||
}
|
||||
v = getInstance(GET_INT_[i]);
|
||||
if (v.getMajor() != GET_RESULT_[i << 2] ||
|
||||
v.getMinor() != GET_RESULT_[(i << 2) + 1] ||
|
||||
v.getMilli() != GET_RESULT_[(i << 2) + 2] ||
|
||||
v.getMicro() != GET_RESULT_[(i << 2) + 3]) {
|
||||
errln(GET_STRING_[i] + " should return major=" +
|
||||
GET_RESULT_[i << 2] + " minor=" +
|
||||
GET_RESULT_[(i << 2) + 1] + " milli=" +
|
||||
errln(GET_STRING_[i] + " should return major=" +
|
||||
GET_RESULT_[i << 2] + " minor=" +
|
||||
GET_RESULT_[(i << 2) + 1] + " milli=" +
|
||||
GET_RESULT_[(i << 2) + 2] + " micro=" +
|
||||
GET_RESULT_[(i << 2) + 3]);
|
||||
GET_RESULT_[(i << 2) + 3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test toString()
|
||||
*/
|
||||
@Test
|
||||
public void TesttoString()
|
||||
public void TesttoString()
|
||||
{
|
||||
for (int i = 0; i < TOSTRING_STRING_.length; i ++) {
|
||||
VersionInfo v = VersionInfo.getInstance(TOSTRING_STRING_[i]);
|
||||
if (!v.toString().equals(TOSTRING_RESULT_[i])) {
|
||||
errln("toString() for " + TOSTRING_STRING_[i] +
|
||||
errln("toString() for " + TOSTRING_STRING_[i] +
|
||||
" should produce " + TOSTRING_RESULT_[i]);
|
||||
}
|
||||
v = getInstance(TOSTRING_INT_[i]);
|
||||
|
@ -186,7 +186,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test Comparable interface
|
||||
*/
|
||||
|
@ -209,8 +209,22 @@ public final class VersionInfoTest extends TestFmwk
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test equals and hashCode
|
||||
*/
|
||||
@Test
|
||||
public void TestEqualsAndHashCode() {
|
||||
VersionInfo v1234a = VersionInfo.getInstance(1, 2, 3, 4);
|
||||
VersionInfo v1234b = VersionInfo.getInstance(1, 2, 3, 4);
|
||||
VersionInfo v1235 = VersionInfo.getInstance(1, 2, 3, 5);
|
||||
|
||||
assertEquals("v1234a and v1234b", v1234a, v1234b);
|
||||
assertEquals("v1234a.hashCode() and v1234b.hashCode()", v1234a.hashCode(), v1234b.hashCode());
|
||||
assertNotEquals("v1234a and v1235", v1234a, v1235);
|
||||
}
|
||||
// private methods --------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* int array versioninfo creation
|
||||
*/
|
||||
|
@ -224,13 +238,13 @@ public final class VersionInfoTest extends TestFmwk
|
|||
case 3:
|
||||
return VersionInfo.getInstance(data[0], data[1], data[2]);
|
||||
default:
|
||||
return VersionInfo.getInstance(data[0], data[1], data[2],
|
||||
return VersionInfo.getInstance(data[0], data[1], data[2],
|
||||
data[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// private data members --------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Test instance data
|
||||
*/
|
||||
|
@ -280,7 +294,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
{255, 255, 255},
|
||||
{255, 255, 255, 255}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Test compare data
|
||||
*/
|
||||
|
@ -294,12 +308,12 @@ public final class VersionInfoTest extends TestFmwk
|
|||
"2.0.0.0", "2.0.0", "2.0", "2"
|
||||
};
|
||||
private static final int COMPARE_EQUAL_INT_[][] = {
|
||||
{2}, {2, 0}, {2, 0, 0}, {2, 0, 0, 0}
|
||||
{2}, {2, 0}, {2, 0, 0}, {2, 0, 0, 0}
|
||||
};
|
||||
private static final String COMPARE_LESS_[] = {
|
||||
"0", "0.0.0.1", "0.0.1", "0.1", "1", "2", "2.1", "2.1.1", "2.1.1.1"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Test Getter data
|
||||
*/
|
||||
|
@ -321,7 +335,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
2, 1, 255, 0,
|
||||
3, 1, 255, 100
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Test toString data
|
||||
*/
|
||||
|
@ -329,7 +343,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
"0",
|
||||
"1.1",
|
||||
"2.1.255",
|
||||
"3.1.255.100"
|
||||
"3.1.255.100"
|
||||
};
|
||||
private static final int TOSTRING_INT_[][] = {
|
||||
{0},
|
||||
|
@ -341,7 +355,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
"0.0.0.0",
|
||||
"1.1.0.0",
|
||||
"2.1.255.0",
|
||||
"3.1.255.100"
|
||||
"3.1.255.100"
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -390,6 +404,7 @@ public final class VersionInfoTest extends TestFmwk
|
|||
this.results = results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
results[i] = VersionInfo.getInstance(i);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dbf812a1c20a17d0718e064e6f3e6917f7345d0e8fc6bbed09b747cb3c12cb88
|
||||
size 55342
|
||||
oid sha256:7b103275ea76672bccc814e88238aa24269e34ccb59bc1fe2980bfbfbd64c4f3
|
||||
size 55361
|
||||
|
|
Loading…
Add table
Reference in a new issue