docs: public Object wrap(Context cx, Scriptable scope,
                         Object obj, Class<?> staticType)
      {
          if (obj == null || obj == Undefined.instance
              || obj instanceof Scriptable)
          {
              return obj;
          }
          if (staticType != null && staticType.isPrimitive()) {
              if (staticType == Void.TYPE)
                  return Undefined.instance;
              if (staticType == Character.TYPE)
                  return Integer.valueOf(((Character) obj).charValue());
              return obj;
          }
          if (!isJavaPrimitiveWrap()) {
              if (obj instanceof String ||
                  obj instanceof Boolean ||
                  obj instanceof Integer ||
                  obj instanceof Short ||
                  obj instanceof Long ||
                  obj instanceof Float ||
                  obj instanceof Double)
              {
                  return obj;
              } else if (obj instanceof Character) {
                  return String.valueOf(((Character)obj).charValue());
              }
          }
          Class<?> cls = obj.getClass();
          if (cls.isArray()) {
              return NativeJavaArray.wrap(scope, obj);
          }
          return wrapAsJavaObject(cx, scope, obj, staticType);
      }