@Override
 public String toString() {
   StringBuffer sb = new StringBuffer();
   for (int i = 0, N = methods.length; i != N; ++i) {
     Method method = methods[i].method();
     sb.append(JavaMembers.javaSignature(method.getReturnType()));
     sb.append(' ');
     sb.append(method.getName());
     sb.append(JavaMembers.liveConnectSignature(methods[i].argTypes));
     sb.append('\n');
   }
   return sb.toString();
 }
 protected void initMembers() {
   Class<?> dynamicType;
   if (javaObject != null) {
     dynamicType = javaObject.getClass();
   } else {
     dynamicType = staticType;
   }
   members = JavaMembers.lookupClass(parent, dynamicType, staticType, isAdapter);
   fieldAndMethods = members.getFieldAndMethodsObjects(this, javaObject, false);
 }
 private static void printDebug(String msg, MemberBox member, Object[] args) {
   if (debug) {
     StringBuffer sb = new StringBuffer();
     sb.append(" ----- ");
     sb.append(msg);
     sb.append(member.getDeclaringClass().getName());
     sb.append('.');
     if (member.isMethod()) {
       sb.append(member.getName());
     }
     sb.append(JavaMembers.liveConnectSignature(member.argTypes));
     sb.append(" for arguments (");
     sb.append(scriptSignature(args));
     sb.append(')');
     System.out.println(sb);
   }
 }
  static String scriptSignature(Object[] values) {
    StringBuffer sig = new StringBuffer();
    for (int i = 0; i != values.length; ++i) {
      Object value = values[i];

      String s;
      if (value == null) {
        s = "null";
      } else if (value instanceof Boolean) {
        s = "boolean";
      } else if (value instanceof String) {
        s = "string";
      } else if (value instanceof Number) {
        s = "number";
      } else if (value instanceof Scriptable) {
        if (value instanceof Undefined) {
          s = "undefined";
        } else if (value instanceof Wrapper) {
          Object wrapped = ((Wrapper) value).unwrap();
          s = wrapped.getClass().getName();
        } else if (value instanceof Function) {
          s = "function";
        } else {
          s = "object";
        }
      } else {
        s = JavaMembers.javaSignature(value.getClass());
      }

      if (i != 0) {
        sig.append(',');
      }
      sig.append(s);
    }
    return sig.toString();
  }
 static void reportConversionError(Object value, Class<?> type) {
   // It uses String.valueOf(value), not value.toString() since
   // value can be null, bug 282447.
   throw Context.reportRuntimeError2(
       "msg.conversion.not.allowed", String.valueOf(value), JavaMembers.javaSignature(type));
 }