8176188: jdk/internal/misc/JavaLangAccess/NewUnsafeString.java failing since 9-b93

Reviewed-by: psandoz, sherman
This commit is contained in:
Claes Redestad 2017-12-05 14:25:16 +01:00
parent 6351f58092
commit 7759531e5c
9 changed files with 5 additions and 138 deletions

View file

@ -645,19 +645,6 @@ public final class String
this(builder, null);
}
/*
* Package private constructor which shares value array for speed.
* this constructor is always expected to be called with share==true.
* a separate constructor is needed because we already have a public
* String(char[]) constructor that makes a copy of the given char[].
*/
// TBD: this is kept for package internal use (Thread/System),
// should be removed if they all have a byte[] version
String(char[] val, boolean share) {
// assert share : "unshared not supported";
this(val, 0, val.length, null);
}
/**
* Returns the length of this string.
* The length is equal to the number of <a href="Character.html#unicode">Unicode

View file

@ -2109,9 +2109,6 @@ public final class System {
public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
Shutdown.add(slot, registerShutdownInProgress, hook);
}
public String newStringUnsafe(char[] chars) {
return new String(chars, true);
}
public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
return new Thread(target, acc);
}

View file

@ -24,9 +24,6 @@
*/
package java.util;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
/**
* {@code StringJoiner} is used to construct a sequence of characters separated
* by a delimiter and optionally starting with a supplied prefix
@ -86,8 +83,6 @@ public final class StringJoiner {
*/
private String emptyValue;
private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
/**
* Constructs a {@code StringJoiner} with no characters in it, with no
* {@code prefix} or {@code suffix}, and a copy of the supplied
@ -189,7 +184,7 @@ public final class StringJoiner {
}
}
k += getChars(suffix, chars, k);
return jla.newStringUnsafe(chars);
return new String(chars);
}
/**
@ -252,7 +247,7 @@ public final class StringJoiner {
elts[i] = null;
} while (++i < size);
size = 1;
elts[0] = jla.newStringUnsafe(chars);
elts[0] = new String(chars);
}
}