ParameterizedType pt = (ParameterizedType) type;
if (pt.getActualTypeArguments().length <= index) return null;
return pt.getActualTypeArguments()[index] instanceof ParameterizedType ?
getConcreteGeneric(pt.getRawType(), 0) : getConcreteGeneric(pt.getActualTypeArguments()[index], 0);
} else if (type instanceof WildcardType) {
WildcardType wt = (WildcardType) type;
return wt.getUpperBounds().length <= index ? null : getConcreteGeneric(wt.getUpperBounds()[index], 0);
} else if (type instanceof TypeVariable) {
TypeVariable tt = (TypeVariable) type;
return tt.getBounds().length <= index ? null : getConcreteGeneric(tt.getBounds()[index], 0);
} else if (type instanceof GenericArrayType) {
GenericArrayType gat = (GenericArrayType) type;