Source:
<code>private static void processGenericSuperType(Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings, Map<TypeVariable<?>, TypeVariable<?>> bindings, Type genericSuperType) { if ( genericSuperType == null ) { return; } else if ( genericSuperType instanceof ParameterizedType ) { Map<TypeVariable<?>, TypeVariable<?>> newBindings = new HashMap<>(); Type[] typeArguments = ( (ParameterizedType) genericSuperType ).getActualTypeArguments(); TypeVariable<?>[] typeParameters = ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ).getTypeParameters(); for ( int i = 0; i < typeArguments.length; i++ ) { Type typeArgument = typeArguments[i]; TypeVariable<?> typeParameter = typeParameters[i]; boolean typeParameterFoundInSubType = false; for ( Entry<TypeVariable<?>, TypeVariable<?>> subTypeParameter : bindings.entrySet() ) { <START> if ( typeArgument == subTypeParameter.getValue() ) { <END> newBindings.put( subTypeParameter.getKey(), typeParameter ); typeParameterFoundInSubType = true; } } if ( !typeParameterFoundInSubType ) { newBindings.put( typeParameter, typeParameter ); } } allBindings.put( ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ), newBindings ); collectTypeBindings( ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ), allBindings, newBindings ); } else if ( genericSuperType instanceof Class ) { allBindings.put( (Class<?>) genericSuperType, Collections.emptyMap() ); } else { throw new IllegalArgumentException( "Unexpected type: " + genericSuperType ); } }</code><technical_language>confirm: totally get instance asking for argument multiple times? Admittedly, feel safer stick equals</technical_language>

Target:
private static void processGenericSuperType(Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings, Map<TypeVariable<?>, TypeVariable<?>> bindings, Type genericSuperType) { if ( genericSuperType == null ) { return; } else if ( genericSuperType instanceof ParameterizedType ) { Map<TypeVariable<?>, TypeVariable<?>> newBindings = new HashMap<>(); Type[] typeArguments = ( (ParameterizedType) genericSuperType ).getActualTypeArguments(); TypeVariable<?>[] typeParameters = ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ).getTypeParameters(); for ( int i = 0; i < typeArguments.length; i++ ) { Type typeArgument = typeArguments[i]; TypeVariable<?> typeParameter = typeParameters[i]; boolean typeParameterFoundInSubType = false; for ( Entry<TypeVariable<?>, TypeVariable<?>> subTypeParameter : bindings.entrySet() ) { if ( typeArgument.equals( subTypeParameter.getValue() ) ) { newBindings.put( subTypeParameter.getKey(), typeParameter ); typeParameterFoundInSubType = true; } } if ( !typeParameterFoundInSubType ) { newBindings.put( typeParameter, typeParameter ); } } allBindings.put( ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ), newBindings ); collectTypeBindings( ( (Class<?>) ( (ParameterizedType) genericSuperType ).getRawType() ), allBindings, newBindings ); } else if ( genericSuperType instanceof Class ) { allBindings.put( (Class<?>) genericSuperType, Collections.emptyMap() ); } else { throw new IllegalArgumentException( "Unexpected type: " + genericSuperType ); } }