/**
  * Replaces instances of Java reserved words that could not appear in a valid Java condition or
  * Java variable name that are being used as variable names in string.
  *
  * @param string the string in which the Java reserved words should be replaced.
  * @return string with the Java reserved words replaced with a substitute names.
  */
 private static String replaceReservedWords(String string) {
   // cheap hack so that pattern never need to look for a key word at
   // the beginning or end of string.  That way one may simplify the pattern
   // to looking for a reserved word that is not prefixed or suffix with a
   // letter or number.
   string = "(" + string + ")";
   for (int i = 0; i < reservedWords.length; i++) {
     String reservedWord = reservedWords[i];
     Pattern p = Pattern.compile("([\\W])(" + reservedWord + ")([\\W])");
     Matcher m = p.matcher(string);
     while (m.find()) {
       string = m.replaceFirst(m.group(1) + "daikon" + reservedWord + m.group(3));
       m = p.matcher(string);
     }
   }
   return string.substring(1, string.length() - 1);
 }