Ejemplo n.º 1
0
 /** Return the declared type of this member, which must be a method or constructor. */
 public MethodType getMethodType() {
   if (type == null) {
     expandFromVM();
     if (type == null) return null;
   }
   if (!isInvocable()) throw newIllegalArgumentException("not invocable, no method type");
   if (type instanceof MethodType) {
     return (MethodType) type;
   }
   if (type instanceof String) {
     String sig = (String) type;
     MethodType res = MethodType.fromMethodDescriptorString(sig, getClassLoader());
     this.type = res;
     return res;
   }
   if (type instanceof Object[]) {
     Object[] typeInfo = (Object[]) type;
     Class<?>[] ptypes = (Class<?>[]) typeInfo[1];
     Class<?> rtype = (Class<?>) typeInfo[0];
     MethodType res = MethodType.methodType(rtype, ptypes);
     this.type = res;
     return res;
   }
   throw new InternalError("bad method type " + type);
 }