< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
rev 55117 : 8223350: [lworld] Use inline classes instead of value classes
@@ -195,13 +195,13 @@
* this method returns "class " followed by {@code getName}.
*
* @return a string representation of this class object.
*/
public String toString() {
- return (isValue() ? "value " : "")
+ return (isValue() ? "inline " : "")
+ (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
- + getName() + (isValue() && isBoxType() ? "/box" : "");
+ + getName() + (isValue() && isBoxType() ? "?" : "");
}
/**
* Returns a string describing this {@code Class}, including
* information about modifiers and type parameters.
@@ -518,14 +518,14 @@
*/
public boolean isValue() {
int mods = this.getModifiers();
if ((mods & VALUE_TYPE) != 0) {
if ((mods & (Modifier.INTERFACE | Modifier.ABSTRACT)) != 0) {
- throw new InternalError("value class can't have ACC_INTERFACE or ACC_ABSTRACT set");
+ throw new InternalError("inline class can't have ACC_INTERFACE or ACC_ABSTRACT set");
}
if (getSuperclass() != Object.class) {
- throw new InternalError("Super class of a value class must be java.lang.Object");
+ throw new InternalError("Super class of an inline class must be java.lang.Object");
}
return true;
}
return false;
}
@@ -635,11 +635,11 @@
public T newInstance()
throws InstantiationException, IllegalAccessException
{
if (this.isValue()) {
throw new IllegalAccessException(
- "cannot create new instance of value class " + this.getName());
+ "cannot create new instance of an inline class " + this.getName());
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), false);
< prev index next >