< prev index next >
src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java
Print this page
rev 54588 : 8212975: ClassDesc should have a full name method
Reviewed-by: vromero
*** 28,37 ****
--- 28,40 ----
import java.lang.invoke.TypeDescriptor;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+ import static java.lang.constant.ConstantUtils.getDisplayDescriptor;
+
+
/**
* A <a href="package-summary.html#nominal">nominal descriptor</a> for a
* {@linkplain MethodType} constant.
*
* @apiNote In the future, if the Java language permits, {@linkplain MethodTypeDesc}
*** 179,193 ****
* canonical names for parameter and return types.
*
* @return the human-readable descriptor for this method type
*/
default String displayDescriptor() {
! return String.format("(%s)%s",
! Stream.of(parameterArray())
! .map(ClassDesc::displayName)
! .collect(Collectors.joining(",")),
! returnType().displayName());
}
/**
* Compares the specified object with this descriptor for equality. Returns
* {@code true} if and only if the specified object is also a
--- 182,202 ----
* canonical names for parameter and return types.
*
* @return the human-readable descriptor for this method type
*/
default String displayDescriptor() {
! return getDisplayDescriptor(this, false);
! }
!
! /**
! * Returns a human-readable descriptor for this method type, using the
! * fully qualified canonical names for parameter and return types.
! *
! * @return the human-readable descriptor for this method type
! */
! default String displayFullDescriptor() {
! return getDisplayDescriptor(this, true);
}
/**
* Compares the specified object with this descriptor for equality. Returns
* {@code true} if and only if the specified object is also a
< prev index next >