private void ityEndings() {
    int old_k = k;
    
    if (endsIn('i', 't', 'y')) {
      word.setLength(j + 1); /* try just removing -ity */
      k = j;
      if (lookup()) return;
      word.unsafeWrite('e'); /* try removing -ity and adding -e */
      k = j + 1;
      if (lookup()) return;
      word.setCharAt(j + 1, 'i');
      word.append("ty");
      k = old_k;
      /*
       * the -ability and -ibility endings are highly productive, so just accept
       * them
       */
      if ((j > 0) && (word.charAt(j - 1) == 'i') && (word.charAt(j) == 'l')) {
        word.setLength(j - 1);
        word.append("le"); /* convert to -ble */
        k = j;
        lookup();
        return;
      }
      
      /* ditto for -ivity */
      if ((j > 0) && (word.charAt(j - 1) == 'i') && (word.charAt(j) == 'v')) {
        word.setLength(j + 1);
        word.unsafeWrite('e'); /* convert to -ive */
        k = j + 1;
        lookup();
        return;
      }
      /* ditto for -ality */
      if ((j > 0) && (word.charAt(j - 1) == 'a') && (word.charAt(j) == 'l')) {
        word.setLength(j + 1);
        k = j;
        lookup();
        return;
      }
      
      /*
       * if the root isn't in the dictionary, and the variant *is* there, then
       * use the variant. This allows `immunity'->`immune', but prevents
       * `capacity'->`capac'. If neither the variant nor the root form are in
       * the dictionary, then remove the ending as a default
       */

      if (lookup()) return;
      
      /* the default is to remove -ity altogether */
      word.setLength(j + 1);
      k = j;
      // nolookup(), we already did it.
      return;
    }
  }
*
YCS: this was the one place where lookup was not followed by return.
So restructure it. if ((j>0)&&(lookup(word.toString())) &&
!((word.charAt(j) == 's') && (word.charAt(j-1) == 's'))) return;
***
linguistics/src/main/java/com/yahoo/language/simple/kstem/KStemmer.java