< 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

@@ -179,15 +179,27 @@
      * canonical names for parameter and return types.
      *
      * @return the human-readable descriptor for this method type
      */
     default String displayDescriptor() {
+        return displayDescriptor(false);
+    }
+
+    /**
+     * Returns a human-readable descriptor for this method type, using the
+     * canonical names for parameter and return types.
+     *
+     * @param detail  if true displays class names in full
+     *
+     * @return the human-readable descriptor for this method type
+     */
+    default String displayDescriptor(boolean detail) {
         return String.format("(%s)%s",
                              Stream.of(parameterArray())
-                                   .map(ClassDesc::displayName)
+                        .map(cd -> cd.displayName(detail))
                                    .collect(Collectors.joining(",")),
-                             returnType().displayName());
+                returnType().displayName(detail));
     }
 
     /**
      * 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 >