private static void checkArgReferences(String typeSnippet,int numberOfArgs){
  Matcher argRefMatcher=ARG_REF_PATTERN.matcher(typeSnippet);
  while (argRefMatcher.find()) {
    int index=Integer.parseInt(argRefMatcher.group(1),10) - 1;
    Preconditions.checkArgument(index >= 0,"%s not allowed, indices start at 1",argRefMatcher.group(0));
    Preconditions.checkArgument(index < numberOfArgs,"%s too large for number of provided type mirrors",argRefMatcher.group(0));
  }
}

private static void checkArgReferences ( String typeSnippet , int numberOfArgs ) { Matcher argRefMatcher = ARG_REF_PATTERN . matcher ( typeSnippet ) ; while ( argRefMatcher . find ( ) ) { int index = Integer . parseInt ( argRefMatcher . group ( 1 ) , 10 ) - 1 ; Preconditions . checkArgument ( index >= 0 , "%s not allowed, indices start at 1" , argRefMatcher . group ( 0 ) ) ; Preconditions . checkArgument ( index < numberOfArgs , "%s too large for number of provided type mirrors" , argRefMatcher . group ( 0 ) ) ; } }
check that all % d references in the given type snippet are within bounds .
