< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
*** 188,198 ****
* @return a string representation of this class object.
*/
public String toString() {
return (isValue() ? "value " : "")
+ (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
! + getName();
}
/**
* Returns a string describing this {@code Class}, including
* information about modifiers and type parameters.
--- 188,198 ----
* @return a string representation of this class object.
*/
public String toString() {
return (isValue() ? "value " : "")
+ (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
! + getName() + (isValue() && isBoxType() ? "/box" : "");
}
/**
* Returns a string describing this {@code Class}, including
* information about modifiers and type parameters.
*** 521,531 ****
* for conversion.
*
* @return the box type of this class if this class is a value class;
* otherwise, this class.
*/
! public Class<?> asBoxType() {
return isValue() ? boxType : this;
}
/**
* Returns a {@code Class} object representing the <em>null-free value type</em>
--- 521,531 ----
* for conversion.
*
* @return the box type of this class if this class is a value class;
* otherwise, this class.
*/
! public Class<T> asBoxType() {
return isValue() ? boxType : this;
}
/**
* Returns a {@code Class} object representing the <em>null-free value type</em>
*** 538,548 ****
* for conversion.
*
* @return the unbox value type of this class if this class is a value class;
* otherwise, {@code null}.
*/
! public Class<?> asValueType() {
return isValue() ? valueType : null;
}
/*
* Returns true if this class is a non-value class or a box value class.
--- 538,548 ----
* for conversion.
*
* @return the unbox value type of this class if this class is a value class;
* otherwise, {@code null}.
*/
! public Class<T> asValueType() {
return isValue() ? valueType : null;
}
/*
* Returns true if this class is a non-value class or a box value class.
*** 550,561 ****
boolean isBoxType() {
return boxType == null || this == boxType;
}
// set by VM if this class is a value type
! private transient Class<?> boxType;
! private transient Class<?> valueType;
/**
* Creates a new instance of the class represented by this {@code Class}
* object. The class is instantiated as if by a {@code new}
* expression with an empty argument list. The class is initialized if it
--- 550,561 ----
boolean isBoxType() {
return boxType == null || this == boxType;
}
// set by VM if this class is a value type
! private transient Class<T> boxType;
! private transient Class<T> valueType;
/**
* Creates a new instance of the class represented by this {@code Class}
* object. The class is instantiated as if by a {@code new}
* expression with an empty argument list. The class is initialized if it
< prev index next >