public static <T> Type[] getActualTypeArguments(
            final Class<T> baseClass, final Class<?> childClass) {

        // Create map
        Map<Type, Type> resolvedTypes;
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
            resolvedTypes = new ArrayMap<>();
        } else {
            resolvedTypes = new HashMap<>();
        }

        Type type = childClass;
        // start walking up the inheritance hierarchy until we hit baseClass
        while (!getClass(type).equals(baseClass)) {
            if (type instanceof Class) {
                // there is no useful information for us in raw types, so just keep going.
                type = ((Class) type).getGenericSuperclass();
            } else {
                ParameterizedType parameterizedType = (ParameterizedType) type;
                Class<?> rawType = (Class) parameterizedType.getRawType();

                Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
                TypeVariable<?>[] typeParameters = rawType.getTypeParameters();
                for (int i = 0; i < actualTypeArguments.length; i++) {
                    resolvedTypes.put(typeParameters[i], actualTypeArguments[i]);
                }

                if (!rawType.equals(baseClass)) {
                    type = rawType.getGenericSuperclass();
                }
            }
        }

        // finally, for each actual type argument provided to baseClass, determine (if possible)
        // the raw class for that type argument.
        Type[] actualTypeArguments;
        if (type instanceof Class) {
            actualTypeArguments = ((Class) type).getTypeParameters();
        } else {
            actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
        }
        // resolve types by chasing down type variables.
        for (int i = 0; i < actualTypeArguments.length; i++) {
            Type tempType = actualTypeArguments[i];

            // First search really type
            while (resolvedTypes.containsKey(tempType)) {
                tempType = resolvedTypes.get(tempType);
            }

            // If the type instanceof ParameterizedType,
            // we need replace types by getActualTypeArguments()
            tempType = replaceTypeActualArgument(tempType, resolvedTypes);

            actualTypeArguments[i] = tempType;
        }
        return actualTypeArguments;
    }
Get the actual type arguments a child class has used to extend a generic
base class.
<p>
Child class must be the implementation class of base class.
Base class must be a generic class.

@param baseClass  the base class
@param childClass the child class
@return a array type of the raw classes for the actual type arguments.
caprice/kit-reflect/src/main/java/net/qiujuer/genius/kit/reflect/Reflector.java