Source:
private static Map<TypeVariable<?>, TypeInformation<?>> bindTypeVariablesWithTypeInformationFromInput(final Type inType, final TypeInformation<?> inTypeInfo) { final List<Type> factoryHierarchy = new ArrayList<Type>(Arrays.asList(inType)); final TypeInfoFactory<?> factory = getClosestFactory(factoryHierarchy, inType); if (factory != null) { final Type factoryDefiningType = resolveTypeFromTypeHierachy(factoryHierarchy.get(factoryHierarchy.size() - 1), factoryHierarchy, true); return bindTypeVariableFromGenericParameters(factoryDefiningType, inTypeInfo); } else if (inType instanceof GenericArrayType) { return bindTypeVariableFromGenericArray(inType, inTypeInfo); } else if (inTypeInfo instanceof TupleTypeInfo && isClassType(inType) && Tuple.class.isAssignableFrom(typeToClass(inType))) { final List<Type> typeHierarchy = new ArrayList<Type>(Arrays.asList(inType)); Type curType = inType; while (!(isClassType(curType) && typeToClass(curType).getSuperclass().equals(Tuple.class))) { typeHierarchy.add(curType); curType = typeToClass(curType).getGenericSuperclass(); } if (curType != inType) { typeHierarchy.add(curType); } final Type tupleBaseClass = resolveTypeFromTypeHierachy(curType, typeHierarchy, true); return bindTypeVariableFromGenericParameters(tupleBaseClass, inTypeInfo); } else if (inTypeInfo instanceof PojoTypeInfo && isClassType(inType)) { return bindTypeVariableFromFields(inType, inTypeInfo); } else if (inType instanceof TypeVariable) { final Map<TypeVariable<?>, TypeInformation<?>> typeVariableBindings = new HashMap<>(); typeVariableBindings.put((TypeVariable<?>) inType, inTypeInfo); return typeVariableBindings; } return Collections.emptyMap(); }

Target:
private static Map<TypeVariable<?>, TypeInformation<?>> bindTypeVariablesWithTypeInformationFromInput( final Type inType, final TypeInformation<?> inTypeInfo) { final List<ParameterizedType> factoryHierarchy = new ArrayList<>(); final TypeInfoFactory<?> factory = getClosestFactory(factoryHierarchy, inType); if (factory != null) { final Type factoryDefiningType = factoryHierarchy.size() < 1 ? inType : resolveTypeFromTypeHierarchy(factoryHierarchy.get(factoryHierarchy.size() - 1), factoryHierarchy, true); return bindTypeVariableFromGenericParameters(factoryDefiningType, inTypeInfo); } else if (inType instanceof GenericArrayType) { return bindTypeVariableFromGenericArray(inType, inTypeInfo); } else if (inTypeInfo instanceof TupleTypeInfo && isClassType(inType) && Tuple.class.isAssignableFrom(typeToClass(inType))) { final List<ParameterizedType> typeHierarchy = new ArrayList<>(); Type curType = inType; while (!(isClassType(curType) && typeToClass(curType).getSuperclass().equals(Tuple.class))) { if (curType instanceof ParameterizedType) { typeHierarchy.add((ParameterizedType) curType); } curType = typeToClass(curType).getGenericSuperclass(); } if (curType instanceof ParameterizedType) { typeHierarchy.add((ParameterizedType) curType); } final Type tupleBaseClass = resolveTypeFromTypeHierarchy(curType, typeHierarchy, true); return bindTypeVariableFromGenericParameters(tupleBaseClass, inTypeInfo); } else if (inTypeInfo instanceof PojoTypeInfo && isClassType(inType)) { return bindTypeVariableFromFields(inType, inTypeInfo); } else if (inType instanceof TypeVariable) { final Map<TypeVariable<?>, TypeInformation<?>> typeVariableBindings = new HashMap<>(); typeVariableBindings.put((TypeVariable<?>) inType, inTypeInfo); return typeVariableBindings; } return Collections.emptyMap(); }