From 5f00fe09e9a611b647592188316e5999465df4d3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 20 Oct 2014 14:48:56 +0900 Subject: Fix some compiler warnings This CL fixes the following compiler warnings. - Indirect access to static member - Access to a non-accessible member of an enclosing type - Parameter assignment - Method can be static - Local variable declaration hides another field or variable - Value of local variable is not used - Unused import - Unused private member - Unnecessary 'else' statement - Unnecessary declaration of throw exception - Redundant type arguments - Missing '@Override' annotation - Unused '@SuppressWarning' annotations Bug: 18003991 Change-Id: Icfebe753e53a2cc621848f769d6a3d7ce501ebc7 --- .../com/android/inputmethod/latin/NgramContext.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/NgramContext.java') diff --git a/java/src/com/android/inputmethod/latin/NgramContext.java b/java/src/com/android/inputmethod/latin/NgramContext.java index a02531cc4..2dc409f9f 100644 --- a/java/src/com/android/inputmethod/latin/NgramContext.java +++ b/java/src/com/android/inputmethod/latin/NgramContext.java @@ -31,14 +31,14 @@ public class NgramContext { public static final NgramContext EMPTY_PREV_WORDS_INFO = new NgramContext(WordInfo.EMPTY_WORD_INFO); public static final NgramContext BEGINNING_OF_SENTENCE = - new NgramContext(WordInfo.BEGINNING_OF_SENTENCE); + new NgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO); /** * Word information used to represent previous words information. */ public static class WordInfo { public static final WordInfo EMPTY_WORD_INFO = new WordInfo(null); - public static final WordInfo BEGINNING_OF_SENTENCE = new WordInfo(); + public static final WordInfo BEGINNING_OF_SENTENCE_WORD_INFO = new WordInfo(); // This is an empty char sequence when mIsBeginningOfSentence is true. public final CharSequence mWord; @@ -48,7 +48,7 @@ public class NgramContext { public final boolean mIsBeginningOfSentence; // Beginning of sentence. - public WordInfo() { + private WordInfo() { mWord = ""; mIsBeginningOfSentence = true; } @@ -96,18 +96,6 @@ public class NgramContext { mPrevWordsCount = prevWordsInfo.length; } - // Construct from WordInfo array and size. The caller shouldn't change prevWordsInfo after - // calling this method. - private NgramContext(final NgramContext ngramContext, final int prevWordsCount) { - if (ngramContext.mPrevWordsCount < prevWordsCount) { - throw new IndexOutOfBoundsException("ngramContext.mPrevWordsCount (" - + ngramContext.mPrevWordsCount + ") is smaller than prevWordsCount (" - + prevWordsCount + ")"); - } - mPrevWordsInfo = ngramContext.mPrevWordsInfo; - mPrevWordsCount = prevWordsCount; - } - // Create next prevWordsInfo using current prevWordsInfo. public NgramContext getNextNgramContext(final WordInfo wordInfo) { final int nextPrevWordCount = Math.min(Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM, -- cgit v1.2.3-83-g751a