test/sun/misc/JavaLangAccess/NewUnsafeString.java
Print this page
rev 7485 : 8009736: Comparator API cleanup
Reviewed-by:
Contributed-by: henry.jen@oracle.com
*** 20,30 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.util.Objects;
! import java.util.Comparators;
import sun.misc.JavaLangAccess;
import sun.misc.SharedSecrets;
/*
* @test
--- 20,30 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.util.Objects;
! import java.util.Comparator;
import sun.misc.JavaLangAccess;
import sun.misc.SharedSecrets;
/*
* @test
*** 46,76 ****
throw new Error("should be different instances");
}
if (!benchmark.equals(constructorCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(benchmark, constructorCopy, Comparators.naturalOrder())) {
throw new Error("Copy not equal");
}
if (benchmark == jlaCopy) {
throw new Error("should be different instances");
}
if (!benchmark.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(benchmark, jlaCopy, Comparators.naturalOrder())) {
throw new Error("Copy not equal");
}
if (constructorCopy == jlaCopy) {
throw new Error("should be different instances");
}
if (!constructorCopy.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(constructorCopy, jlaCopy, Comparators.naturalOrder())) {
throw new Error("Copy not equal");
}
// The following is extremely "evil". Never ever do this in non-test code.
jlaChars[0] = 'X';
--- 46,76 ----
throw new Error("should be different instances");
}
if (!benchmark.equals(constructorCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(benchmark, constructorCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
if (benchmark == jlaCopy) {
throw new Error("should be different instances");
}
if (!benchmark.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(benchmark, jlaCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
if (constructorCopy == jlaCopy) {
throw new Error("should be different instances");
}
if (!constructorCopy.equals(jlaCopy)) {
throw new Error("Copy not equal");
}
! if (0 != Objects.compare(constructorCopy, jlaCopy, Comparator.naturalOrder())) {
throw new Error("Copy not equal");
}
// The following is extremely "evil". Never ever do this in non-test code.
jlaChars[0] = 'X';