mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8266972: Use String.concat() in j.l.Class where invokedynamic-based String concatenation is not available
Reviewed-by: redestad
This commit is contained in:
parent
72145f3b94
commit
6c4c48faea
1 changed files with 5 additions and 5 deletions
|
@ -232,8 +232,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
* @return a string representation of this {@code Class} object.
|
||||
*/
|
||||
public String toString() {
|
||||
return (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
|
||||
+ getName();
|
||||
String kind = isInterface() ? "interface " : isPrimitive() ? "" : "class ";
|
||||
return kind.concat(getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1657,7 +1657,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
|
||||
private String getSimpleName0() {
|
||||
if (isArray()) {
|
||||
return getComponentType().getSimpleName() + "[]";
|
||||
return getComponentType().getSimpleName().concat("[]");
|
||||
}
|
||||
String simpleName = getSimpleBinaryName();
|
||||
if (simpleName == null) { // top level class
|
||||
|
@ -1682,7 +1682,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
dimensions++;
|
||||
cl = cl.getComponentType();
|
||||
} while (cl.isArray());
|
||||
return cl.getName() + "[]".repeat(dimensions);
|
||||
return cl.getName().concat("[]".repeat(dimensions));
|
||||
} catch (Throwable e) { /*FALLTHRU*/ }
|
||||
}
|
||||
return getName();
|
||||
|
@ -1717,7 +1717,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
if (isArray()) {
|
||||
String canonicalName = getComponentType().getCanonicalName();
|
||||
if (canonicalName != null)
|
||||
return canonicalName + "[]";
|
||||
return canonicalName.concat("[]");
|
||||
else
|
||||
return ReflectionData.NULL_SENTINEL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue