am 6d7a0810: Merge "Fix a verifier error on ICS." into lmp-dev

* commit '6d7a08107cd62620a2a07d445686e76c2d660bcf':
  Fix a verifier error on ICS.
main
Jean Chalard 2014-07-28 12:09:04 +00:00 committed by Android Git Automerger
commit ac82983f65
2 changed files with 11 additions and 4 deletions

View File

@ -153,7 +153,7 @@ public final class AndroidSpellCheckerSession extends AndroidWordLevelSpellCheck
*/
private SentenceSuggestionsInfo[] splitAndSuggest(TextInfo[] textInfos, int suggestionsLimit) {
if (textInfos == null || textInfos.length == 0) {
return SentenceLevelAdapter.EMPTY_SENTENCE_SUGGESTIONS_INFOS;
return SentenceLevelAdapter.getEmptySentenceSuggestionsInfo();
}
SentenceLevelAdapter sentenceLevelAdapter;
synchronized(this) {
@ -168,7 +168,7 @@ public final class AndroidSpellCheckerSession extends AndroidWordLevelSpellCheck
}
}
if (sentenceLevelAdapter == null) {
return SentenceLevelAdapter.EMPTY_SENTENCE_SUGGESTIONS_INFOS;
return SentenceLevelAdapter.getEmptySentenceSuggestionsInfo();
}
final int infosSize = textInfos.length;
final SentenceSuggestionsInfo[] retval = new SentenceSuggestionsInfo[infosSize];

View File

@ -35,9 +35,16 @@ import java.util.Locale;
* rewrite everything for any small change.
*/
public class SentenceLevelAdapter {
public static final SentenceSuggestionsInfo[] EMPTY_SENTENCE_SUGGESTIONS_INFOS =
new SentenceSuggestionsInfo[] {};
private static class EmptySentenceSuggestionsInfosInitializationHolder {
public static final SentenceSuggestionsInfo[] EMPTY_SENTENCE_SUGGESTIONS_INFOS =
new SentenceSuggestionsInfo[]{};
}
private static final SuggestionsInfo EMPTY_SUGGESTIONS_INFO = new SuggestionsInfo(0, null);
public static SentenceSuggestionsInfo[] getEmptySentenceSuggestionsInfo() {
return EmptySentenceSuggestionsInfosInitializationHolder.EMPTY_SENTENCE_SUGGESTIONS_INFOS;
}
/**
* Container for split TextInfo parameters
*/