Remove useless code (A25)

isWhitelistedOrNotAWord takes an 'ignoreCase' argument. By looking
at the contents of the wordcomposer here, there is only one case
where its output will be different : when the word is typed with a
capital, but the lower case version exists in the dictionary.
E.g. the user typed "This".

In this case, isWhitelistedOrNotAWord in line 235 will return false
instead of true, so the test will score a true instead of a false,
so hasAutoCorrection may be true instead of false in this specific
case and that's the only case where it's different.

But in this case, allowsToBeAutoCorrected is certain to be false,
which means the result will not have changed if hasAutoCorrection
was true in the first place. So in the end this change is sure not
to change the behavior.

Change-Id: Ic41cf959c20c19165f84d9b8ff006731fa595d84
main
Jean Chalard 2012-06-28 17:41:18 +09:00
parent b3cfde2cbb
commit 7a94cbd2a4
1 changed files with 1 additions and 4 deletions

View File

@ -232,7 +232,7 @@ public class Suggest {
} else if (null != whitelistedWord) { } else if (null != whitelistedWord) {
hasAutoCorrection = true; hasAutoCorrection = true;
} else if (!AutoCorrection.isWhitelistedOrNotAWord( } else if (!AutoCorrection.isWhitelistedOrNotAWord(
mDictionaries, consideredWord, false)) { mDictionaries, consideredWord, wordComposer.isFirstCharCapitalized())) {
hasAutoCorrection = true; hasAutoCorrection = true;
} else if (suggestionsSet.isEmpty()) { } else if (suggestionsSet.isEmpty()) {
hasAutoCorrection = false; hasAutoCorrection = false;
@ -296,9 +296,6 @@ public class Suggest {
&& hasMainDictionary(); && hasMainDictionary();
boolean autoCorrectionAvailable = hasAutoCorrection; boolean autoCorrectionAvailable = hasAutoCorrection;
if (isCorrectionEnabled) {
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
}
// Don't auto-correct words with multiple capital letter // Don't auto-correct words with multiple capital letter
autoCorrectionAvailable &= !wordComposer.isMostlyCaps(); autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
autoCorrectionAvailable &= !wordComposer.isResumed(); autoCorrectionAvailable &= !wordComposer.isResumed();