mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8287013: StringConcatFactory: remove short and byte mixers/prependers
Reviewed-by: jlaskey
This commit is contained in:
parent
828dc89ab8
commit
d5d19f52ce
2 changed files with 13 additions and 75 deletions
|
@ -496,7 +496,19 @@ public final class StringConcatFactory {
|
|||
Class<?>[] ptypes = mt.erase().parameterArray();
|
||||
MethodHandle[] filters = null;
|
||||
for (int i = 0; i < ptypes.length; i++) {
|
||||
MethodHandle filter = stringifierFor(ptypes[i]);
|
||||
Class<?> cl = ptypes[i];
|
||||
MethodHandle filter = null;
|
||||
if (cl == byte.class || cl == short.class) {
|
||||
// use int for subword integral types; still need special mixers
|
||||
// and prependers for char, boolean
|
||||
ptypes[i] = int.class;
|
||||
} else if (cl == Object.class) {
|
||||
filter = objectStringifier();
|
||||
} else if (cl == float.class) {
|
||||
filter = floatStringifier();
|
||||
} else if (cl == double.class) {
|
||||
filter = doubleStringifier();
|
||||
}
|
||||
if (filter != null) {
|
||||
if (filters == null) {
|
||||
filters = new MethodHandle[ptypes.length];
|
||||
|
@ -825,24 +837,6 @@ public final class StringConcatFactory {
|
|||
MIXERS = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stringifier for references and floats/doubles only.
|
||||
* Always returns null for other primitives.
|
||||
*
|
||||
* @param t class to stringify
|
||||
* @return stringifier; null, if not available
|
||||
*/
|
||||
private static MethodHandle stringifierFor(Class<?> t) {
|
||||
if (t == Object.class) {
|
||||
return objectStringifier();
|
||||
} else if (t == float.class) {
|
||||
return floatStringifier();
|
||||
} else if (t == double.class) {
|
||||
return doubleStringifier();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static MethodHandle lookupStatic(Lookup lookup, Class<?> refc, String name,
|
||||
Class<?> rtype, Class<?>... ptypes) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue