--- old/src/java.base/share/classes/java/lang/Class.java 2018-11-26 16:24:34.000000000 -0800
+++ new/src/java.base/share/classes/java/lang/Class.java 2018-11-26 16:24:34.000000000 -0800
@@ -820,10 +820,6 @@
* by
* The Java™ Language Specification.
*
- *
If this class object represents a value type, then the name returned
- * is a {@code String} equal to the name of the {@linkplain #asBoxType()
- * box value type} appended with {@code "/val"}.
- *
*
If this class object represents a primitive type or void, then the
* name returned is a {@code String} equal to the Java language
* keyword corresponding to the primitive type or void.
@@ -844,6 +840,8 @@
*
char | C
* |
---|
class or interface
* | Lclassname;
+ * |
---|
{@linkplain #asValueType() regular value class}
+ * | Qclassname;
* |
---|
double | D
* |
---|
float | F
* |
---|
int | I
@@ -863,10 +861,10 @@
* returns "byte"
* Point.class.getName()
* returns "p.Point"
- * Point.class.asValueType().getName()
- * returns "p.Point/val"
* (new Object[3]).getClass().getName()
* returns "[Ljava.lang.Object;"
+ * (new Point[3]).getClass().getName()
+ * returns "[QPoint;"
* (new int[3][4][5][6][7][8][9]).getClass().getName()
* returns "[[[[[[[I"
*
@@ -877,7 +875,8 @@
public String getName() {
String name = this.name;
if (name == null) {
- this.name = name = isBoxType() ? getName0() : getName0() + "/val";
+ // this.name = name = isBoxType() ? getName0() : getName0() + "/val";
+ this.name = name = getName0();
}
return name;
}
@@ -1660,7 +1659,7 @@
simpleName = getName();
simpleName = simpleName.substring(simpleName.lastIndexOf('.') + 1); // strip the package name
}
- return simpleName;
+ return isBoxType() ? simpleName : simpleName + "/val";
}
/**
@@ -1679,14 +1678,14 @@
cl = cl.getComponentType();
} while (cl.isArray());
StringBuilder sb = new StringBuilder();
- sb.append(cl.getName());
+ sb.append(cl.getTypeName());
for (int i = 0; i < dimensions; i++) {
sb.append("[]");
}
return sb.toString();
} catch (Throwable e) { /*FALLTHRU*/ }
}
- return getName();
+ return isBoxType() ? getName() : getName() + "/val";
}
/**
|
---|