If you look at the code from equals(), I think it misses this check :

"AX".equals("A");

since it does not check if the termLength() are different.

Here is an example of a fix, it may not be optimal, but I think checking size as the first thing is better than checking size after looping.

public boolean equals(Object other) {
    if (other == this) {
      return true;
    }
   
    //Check for size also
    if (termLength() != ((TermAttributeImpl)other).termLength()) {
      return false;
    }

    if (other instanceof TermAttribute) {
      initTermBuffer();
      TermAttributeImpl o = ((TermAttributeImpl) other);
      o.initTermBuffer();
      
      for(int i=0;i<termLength;i++) {
        if (termBuffer[i] != o.termBuffer[i]) {
          return false;
        }
      }
      return true;
    }
    
    return false;
  }