< prev index next >

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

Print this page
@@ -128,10 +128,11 @@
             int slot,
             String signature,
             byte[] annotations,
             byte[] parameterAnnotations,
             byte[] annotationDefault) {
+         assert declaringClass.isPrimaryType();
          this.clazz = declaringClass;
          this.name = name;
          this.parameterTypes = parameterTypes;
          this.returnType = returnType;
          this.exceptionTypes = checkedExceptions;

@@ -417,17 +418,17 @@
      }
  
      @Override
      void specificToStringHeader(StringBuilder sb) {
          sb.append(getReturnType().getTypeName()).append(' ');
-         sb.append(getDeclaringClass().getTypeName()).append('.');
+         sb.append(getDeclaringClassTypeName()).append('.');
          sb.append(getName());
      }
  
      @Override
      String toShortString() {
-         return "method " + getDeclaringClass().getTypeName() +
+         return "method " + getDeclaringClassTypeName() +
                  '.' + toShortSignature();
      }
  
      String toShortSignature() {
          StringJoiner sj = new StringJoiner(",", getName() + "(", ")");

@@ -486,11 +487,11 @@
  
      @Override
      void specificToGenericStringHeader(StringBuilder sb) {
          Type genRetType = getGenericReturnType();
          sb.append(genRetType.getTypeName()).append(' ');
-         sb.append(getDeclaringClass().getTypeName()).append('.');
+         sb.append(getDeclaringClassTypeName()).append('.');
          sb.append(getName());
      }
  
      /**
       * Invokes the underlying method represented by this {@code Method}
< prev index next >