(Class) ((ParameterizedType) types[i]).getRawType());
(Class<? extends Object>) ((ParameterizedType) types[i]).getRawType());
   static Object[] deSerializeParameters(Object[] parameters, Type[] types) throws Exception   {      if (null == parameters) return null;      for (int i = 0; i < parameters.length; i++) {         if (types[i] instanceof Class &&               DBusSerializable.class.isAssignableFrom((Class) types[i])) {            for (Method m: ((Class) types[i]).getDeclaredMethods())                if (m.getName().equals("deserialize")) {                  Type[] newtypes = m.getGenericParameterTypes();                  try {                     Object[] sub = new Object[newtypes.length];                     System.arraycopy(parameters, i, sub, 0, newtypes.length);                      sub = deSerializeParameters(sub, newtypes);                     DBusSerializable sz = (DBusSerializable) ((Class) types[i]).newInstance();                     m.invoke(sz, sub);                     Object[] compress = new Object[parameters.length - newtypes.length + 1];                     System.arraycopy(parameters, 0, compress, 0, i);                     compress[i] = sz;                     System.arraycopy(parameters, i + newtypes.length, compress, i+1, parameters.length - i - newtypes.length);                     parameters = compress;                  } catch (ArrayIndexOutOfBoundsException AIOOBe) {                     throw new DBusException("Not enough elements to create custom object from serialized data ("+(parameters.length-i)+" < "+(newtypes.length)+")");                  }               }         }                  // its a wrapped variant, unwrap it         if (types[i] instanceof TypeVariable                && parameters[i] instanceof Variant) {            parameters[i] = ((Variant)parameters[i]).getValue();         }         // its a wrapped map, unwrap it         if (parameters[i] instanceof MapContainer)            parameters[i] = ((MapContainer) parameters[i]).getMap(types[i]);                 // its a wrapped list, unwrap it         if (parameters[i] instanceof ListContainer) {            parameters[i] = ((ListContainer) parameters[i]).getList(types[i]);         }         // it should be a struct. create it         if (parameters[i] instanceof Object[] &&                types[i] instanceof Class &&               Struct.class.isAssignableFrom((Class) types[i])) {            Field[] fs = ((Class) types[i]).getDeclaredFields();            Type[] ts = new Type[fs.length];            for (Field f : fs) {               Position p = f.getAnnotation(Position.class);               if (null == p) continue;               ts[p.value()] = f.getGenericType();            }            // recurse over struct contents            parameters[i] = deSerializeParameters((Object[]) parameters[i], ts);            for (Constructor con: ((Class) types[i]).getDeclaredConstructors()) {               try {                  parameters[i] = con.newInstance((Object[]) parameters[i]);                  break;               } catch (IllegalArgumentException IAe) {}            }         }         // recurse over arrays         if (parameters[i] instanceof Object[]) {            Type[] ts = new Type[((Object[]) parameters[i]).length];            Arrays.fill(ts, parameters[i].getClass().getComponentType());            parameters[i] = deSerializeParameters((Object[]) parameters[i],                  ts);         }         // make sure arrays are in the correct format         if ((parameters[i] instanceof Object[] ||                  parameters[i] instanceof List)) {            if (types[i] instanceof ParameterizedType)               parameters[i] = ArrayFrob.convert(parameters[i],                     (Class) ((ParameterizedType) types[i]).getRawType());            else if (types[i] instanceof GenericArrayType) {               Type ct = ((GenericArrayType) types[i]).getGenericComponentType();               Class cc = null;               if (ct instanceof Class)                  cc = (Class) ct;               if (ct instanceof ParameterizedType)                  cc = (Class) ((ParameterizedType) ct).getRawType();               Object o = Array.newInstance(cc, 0);               parameters[i] = ArrayFrob.convert(parameters[i],                     o.getClass());            } else if (types[i] instanceof Class &&                  ((Class) types[i]).isArray()) {               Class cc = ((Class) types[i]).getComponentType();               Object o = Array.newInstance(cc, 0);               parameters[i] = ArrayFrob.convert(parameters[i],                     o.getClass());            }         }      }      return parameters;   }