/*non-public*/ boolean isConvertibleTo(MethodType newType) { if (!canConvert(returnType(), newType.returnType())) return false; int argc = parameterCount(); if (argc != newType.parameterCount()) return false; for (int i = 0; i < argc; i++) { if (!canConvert(newType.parameterType(i), parameterType(i))) return false; } return true; }
/** * Return the declared type of this member, which must be a field or type. If it is a type member, * that type itself is returned. */ public Class<?> getFieldType() { if (type == null) { expandFromVM(); if (type == null) return null; } if (isInvocable()) throw newIllegalArgumentException("not a field or nested class, no simple type"); if (type instanceof Class<?>) { return (Class<?>) type; } if (type instanceof String) { String sig = (String) type; MethodType mtype = MethodType.fromMethodDescriptorString("()" + sig, getClassLoader()); Class<?> res = mtype.returnType(); this.type = res; return res; } throw new InternalError("bad field type " + type); }