Buggy code:
public class MvcUriComponentsBuilder extends UriComponentsBuilder { public static final String MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME = "mvcUriComponentsContributor" ; private static final CompositeUriComponentsContributor defaultUriComponentsContributor ; private static final PathMatcher pathMatcher = new AntPathMatcher ( ) ; private static final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer ( ) ; private static final ObjenesisStd objenesis = new ObjenesisStd ( true ) ; private static Log logger = LogFactory . getLog ( MvcUriComponentsBuilder . class ) ; public static UriComponentsBuilder fromController ( Class < ? > controllerType ) { } public static UriComponentsBuilder fromMethodName ( Class < ? > controllerType , String methodName , Object ... argumentValues ) { } public static UriComponentsBuilder fromMethod ( Method method , Object ... argumentValues ) { } public static UriComponentsBuilder fromLastCall ( Object methodInvocationInfo ) { } private static String getTypeRequestMapping ( Class < ? > controllerType ) { } private static String getMethodRequestMapping ( Method method ) { } private static UriComponents applyContributors ( UriComponentsBuilder builder , Method method , Object [ ] args ) { CompositeUriComponentsContributor contributor = MvcUriComponentsBuilder . getConfiguredUriComponentsContributor ( ) ; if ( contributor == null ) { MvcUriComponentsBuilder . logger . debug ( "Using<seq2seq4repair_space>default<seq2seq4repair_space>CompositeUriComponentsContributor" ) ; contributor = MvcUriComponentsBuilder . defaultUriComponentsContributor ; } <START_BUG> int paramCount = method . getParameterCount ( ) ; <END_BUG> int argCount = args . length ; Assert . isTrue ( ( paramCount == argCount ) , ( ( ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>method<seq2seq4repair_space>parameters<seq2seq4repair_space>" + paramCount ) + "<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>match<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>argument<seq2seq4repair_space>values<seq2seq4repair_space>" ) + argCount ) ) ; Map < String , Object > uriVars = new HashMap < String , Object > ( ) ; for ( int i = 0 ; i < paramCount ; i ++ ) { MethodParameter param = new MethodParameter ( method , i ) ; param . initParameterNameDiscovery ( MvcUriComponentsBuilder . parameterNameDiscoverer ) ; contributor . contributeMethodArgument ( param , args [ i ] , builder , uriVars ) ; } return builder . buildAndExpand ( uriVars ) ; } protected static CompositeUriComponentsContributor getConfiguredUriComponentsContributor ( ) { } public static < T > T mock ( Class < T > controllerType ) { } @ SuppressWarnings ( "unchecked" ) private static < T > T initProxy ( Class < ? > type , MvcUriComponentsBuilder . ControllerMethodInvocationInterceptor interceptor ) { } private static class ControllerMethodInvocationInterceptor implements MethodInterceptor , org . springframework . cglib . proxy . MethodInterceptor { private static final Method getControllerMethod = ReflectionUtils . findMethod ( MvcUriComponentsBuilder . MethodInvocationInfo . class , "getControllerMethod" ) ; private static final Method getArgumentValues = ReflectionUtils . findMethod ( MvcUriComponentsBuilder . MethodInvocationInfo . class , "getArgumentValues" ) ; private Method controllerMethod ; private Object [ ] argumentValues ; @ Override public Object intercept ( Object obj , Method method , Object [ ] args , MethodProxy proxy ) { } @ Override public Object invoke ( MethodInvocation inv ) throws Throwable { } } public interface MethodInvocationInfo { Method getControllerMethod ( ) { } Object [ ] getArgumentValues ( ) { } } }

Fix:
int paramCount = method . getParameterTypes ( ) . length ;