Пример #1
0
 /**
  * Returns a string representation of the method type, of the form {@code "(PT0,PT1...)RT"}. The
  * string representation of a method type is a parenthesis enclosed, comma separated list of type
  * names, followed immediately by the return type.
  *
  * <p>Each type is represented by its {@link java.lang.Class#getSimpleName simple name}.
  */
 @Override
 public String toString() {
   StringBuilder sb = new StringBuilder();
   sb.append("(");
   for (int i = 0; i < ptypes.length; i++) {
     if (i > 0) sb.append(",");
     sb.append(ptypes[i].getSimpleName());
   }
   sb.append(")");
   sb.append(rtype.getSimpleName());
   return sb.toString();
 }
Пример #2
0
 /**
  * Produce a string form of this member name. For types, it is simply the type's own string (as
  * reported by {@code toString}). For fields, it is {@code "DeclaringClass.name/type"}. For
  * methods and constructors, it is {@code "DeclaringClass.name(ptype...)rtype"}. If the declaring
  * class is null, the prefix {@code "DeclaringClass."} is omitted. If the member is unresolved, a
  * prefix {@code "*."} is prepended.
  */
 @Override
 public String toString() {
   if (isType()) return type.toString(); // class java.lang.String
   // else it is a field, method, or constructor
   StringBuilder buf = new StringBuilder();
   if (getDeclaringClass() != null) {
     buf.append(getName(clazz));
     buf.append('.');
   }
   String name = getName();
   buf.append(name == null ? "*" : name);
   Object type = getType();
   if (!isInvocable()) {
     buf.append('/');
     buf.append(type == null ? "*" : getName(type));
   } else {
     buf.append(type == null ? "(*)*" : getName(type));
   }
   /*
   buf.append('/');
   // key: Public, private, pRotected, sTatic, Final, sYnchronized,
   // transient/Varargs, native, (interface), abstract, sTrict, sYnthetic,
   // (annotation), Enum, (unused)
   final String FIELD_MOD_CHARS  = "PprTF?vt????Y?E?";
   final String METHOD_MOD_CHARS = "PprTFybVn?atY???";
   String modChars = (isInvocable() ? METHOD_MOD_CHARS : FIELD_MOD_CHARS);
   for (int i = 0; i < modChars.length(); i++) {
       if ((flags & (1 << i)) != 0) {
           char mc = modChars.charAt(i);
           if (mc != '?')
               buf.append(mc);
       }
   }
    */
   return buf.toString();
 }