< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodType.java

Print this page
@@ -38,10 +38,11 @@
  import java.util.Objects;
  import java.util.Optional;
  import java.util.StringJoiner;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.concurrent.ConcurrentMap;
+ import java.util.stream.Collectors;
  import java.util.stream.Stream;
  
  import jdk.internal.vm.annotation.Stable;
  import sun.invoke.util.BytecodeDescriptor;
  import sun.invoke.util.VerifyType;

@@ -887,17 +888,24 @@
       * {@link java.lang.Class#getSimpleName simple name}.
       */
      @Override
      public String toString() {
          StringJoiner sj = new StringJoiner(",", "(",
-                 ")" + rtype.getSimpleName());
+                 ")" + toSimpleName(rtype));
          for (int i = 0; i < ptypes.length; i++) {
-             sj.add(ptypes[i].getSimpleName());
+             sj.add(toSimpleName(ptypes[i]));
          }
          return sj.toString();
      }
  
+     static String toSimpleName(Class<?> c) {
+         if (c.isPrimitiveClass() && c.isPrimaryType()) {
+             return c.getSimpleName() + ".ref";
+         } else {
+             return c.getSimpleName();
+         }
+     }
      /** True if my parameter list is effectively identical to the given full list,
       *  after skipping the given number of my own initial parameters.
       *  In other words, after disregarding {@code skipPos} parameters,
       *  my remaining parameter list is no longer than the {@code fullList}, and
       *  is equal to the same-length initial sublist of {@code fullList}.
< prev index next >