Buggy code:
public class ParameterizedGenericMethodBinding extends ParameterizedMethodBinding implements Substitution { public TypeBinding [ ] typeArguments ; private LookupEnvironment environment ; public boolean inferredReturnType ; public boolean wasInferred ; public boolean isRaw ; public MethodBinding tiebreakMethod ; public boolean isUnchecked ; public static MethodBinding computeCompatibleMethod ( MethodBinding originalMethod , TypeBinding [ ] arguments , Scope scope , InvocationSite invocationSite ) { ParameterizedGenericMethodBinding methodSubstitute ; TypeVariableBinding [ ] typeVariables = originalMethod . typeVariables ; TypeBinding [ ] substitutes = invocationSite . genericTypeArguments ( ) ; computeSubstitutes : { if ( substitutes != null ) { if ( ( substitutes . length ) != ( typeVariables . length ) ) { return new ProblemMethodBinding ( originalMethod , originalMethod . selector , substitutes , TypeParameterArityMismatch ) ; } methodSubstitute = new ParameterizedGenericMethodBinding ( originalMethod , substitutes , scope . environment ( ) ) ; break computeSubstitutes ; } TypeBinding [ ] parameters = originalMethod . parameters ; int varLength = typeVariables . length ; Map collectedSubstitutes = new HashMap ( varLength ) ; for ( int i = 0 ; i < varLength ; i ++ ) collectedSubstitutes . put ( typeVariables [ i ] , new TypeBinding [ 3 ] [ ] ) ; substitutes = new TypeBinding [ varLength ] ; methodSubstitute = ParameterizedGenericMethodBinding . inferFromArgumentTypes ( scope , originalMethod , arguments , parameters , collectedSubstitutes , substitutes ) ; if ( methodSubstitute == null ) return null ; if ( ParameterizedGenericMethodBinding . hasUnresolvedTypeArgument ( substitutes ) ) { TypeBinding expectedType = null ; if ( invocationSite instanceof MessageSend ) { MessageSend message = ( ( MessageSend ) ( invocationSite ) ) ; expectedType = message . expectedType ; } TypeBinding upperBound ; TypeBinding substitutedReturnType = methodSubstitute . returnType ; switch ( substitutedReturnType . kind ( ) ) { case Binding . TYPE_PARAMETER : <START_BUG> upperBound = ( ( TypeVariableBinding ) ( substitutedReturnType ) ) . upperBound ( ) ; <END_BUG> break ; case Binding . BASE_TYPE : if ( substitutedReturnType == ( VoidBinding ) ) { upperBound = null ; break ; } default : upperBound = scope . getJavaLangObject ( ) ; } if ( ( expectedType == null ) || ( ( upperBound != null ) && ( upperBound . isCompatibleWith ( expectedType ) ) ) ) { expectedType = upperBound ; } methodSubstitute = methodSubstitute . inferFromExpectedType ( scope , expectedType , collectedSubstitutes , substitutes ) ; if ( methodSubstitute == null ) return null ; } } if ( ! ( methodSubstitute . isRaw ) ) { for ( int i = 0 , length = typeVariables . length ; i < length ; i ++ ) { TypeVariableBinding typeVariable = typeVariables [ i ] ; TypeBinding substitute = methodSubstitute . typeArguments [ i ] ; switch ( typeVariable . boundCheck ( methodSubstitute , substitute ) ) { case MISMATCH : return new ProblemMethodBinding ( methodSubstitute , originalMethod . selector , new TypeBinding [ ] { substitute , typeVariables [ i ] } , ParameterBoundMismatch ) ; case UNCHECKED : methodSubstitute . isUnchecked = true ; break ; } } } return methodSubstitute ; } private static boolean hasUnresolvedTypeArgument ( TypeBinding [ ] substitutes ) { } private static ParameterizedGenericMethodBinding inferFromArgumentTypes ( Scope scope , MethodBinding originalMethod , TypeBinding [ ] arguments , TypeBinding [ ] parameters , Map collectedSubstitutes , TypeBinding [ ] substitutes ) { } private static TypeBinding [ ] resolveSubstituteConstraints ( Scope scope , TypeVariableBinding [ ] typeVariables , TypeBinding [ ] substitutes , boolean considerEXTENDSConstraints , Map collectedSubstitutes ) { } public ParameterizedGenericMethodBinding ( MethodBinding originalMethod , RawTypeBinding rawType , LookupEnvironment environment ) { } public ParameterizedGenericMethodBinding ( MethodBinding originalMethod , TypeBinding [ ] typeArguments , LookupEnvironment environment ) { } public char [ ] computeUniqueKey ( boolean isLeaf ) { } public LookupEnvironment environment ( ) { } public boolean hasSubstitutedParameters ( ) { } public boolean hasSubstitutedReturnType ( ) { } private ParameterizedGenericMethodBinding inferFromExpectedType ( Scope scope , TypeBinding expectedType , Map collectedSubstitutes , TypeBinding [ ] substitutes ) { } public boolean isRawSubstitution ( ) { } public TypeBinding substitute ( TypeVariableBinding originalVariable ) { } public MethodBinding tiebreakMethod ( ) { } }

Fix:
upperBound = Scope . substitute ( methodSubstitute , ( ( TypeVariableBinding ) ( substitutedReturnType ) ) . upperBound ( ) ) ;