src/share/classes/java/lang/reflect/Method.java

Print this page

        

@@ -340,13 +340,12 @@
      *
      * <p>The access modifiers are placed in canonical order as
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
-     * {@code synchronized}, {@code native}, {@code strictfp},
-     * {@code default}.
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
+     * {@code synchronized}, {@code native}, {@code strictfp}.
      *
      * @return a string describing this {@code Method}
      *
      * @jls 8.4.3 Method Modifiers
      */

@@ -357,12 +356,12 @@
                               exceptionTypes);
     }
 
     @Override
     void specificToStringHeader(StringBuilder sb) {
-        sb.append(Field.getTypeName(getReturnType())).append(' ');
-        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(getReturnType().getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
         sb.append(getName());
     }
 
     /**
      * Returns a string describing this {@code Method}, including

@@ -385,20 +384,18 @@
      * type parameters, the type parameter list is elided; if the type
      * parameter list is present, a space separates the list from the
      * class name.  If the method is declared to throw exceptions, the
      * parameter list is followed by a space, followed by the word
      * throws followed by a comma-separated list of the generic thrown
-     * exception types.  If there are no type parameters, the type
-     * parameter list is elided.
+     * exception types.
      *
      * <p>The access modifiers are placed in canonical order as
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
-     * {@code synchronized}, {@code native}, {@code strictfp},
-     * {@code default}.
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
+     * {@code synchronized}, {@code native}, {@code strictfp}.
      *
      * @return a string describing this {@code Method},
      * include type parameters
      *
      * @since 1.5

@@ -411,15 +408,12 @@
     }
 
     @Override
     void specificToGenericStringHeader(StringBuilder sb) {
         Type genRetType = getGenericReturnType();
-        sb.append( ((genRetType instanceof Class<?>)?
-                    Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
-            .append(' ');
-
-        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(genRetType.getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
         sb.append(getName());
     }
 
     /**
      * Invokes the underlying method represented by this {@code Method}