Merge "Revert "[HW7.5] Introduce the @Nonnull annotation"" into lmp-dev

This commit is contained in:
Ken Wakasa 2014-07-29 15:44:39 +00:00 committed by Android (Google) Code Review
commit 666f1b384f
6 changed files with 5 additions and 16 deletions

View file

@ -25,7 +25,7 @@ LOCAL_CERTIFICATE := shared
LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime
LOCAL_STATIC_JAVA_LIBRARIES := android-common inputmethod-common android-support-v4 jsr305 LOCAL_STATIC_JAVA_LIBRARIES := android-common inputmethod-common android-support-v4
# Do not compress dictionary files to mmap dict data runtime # Do not compress dictionary files to mmap dict data runtime
LOCAL_AAPT_FLAGS := -0 .dict LOCAL_AAPT_FLAGS := -0 .dict

View file

@ -18,8 +18,6 @@ package com.android.inputmethod.event;
import java.util.ArrayList; import java.util.ArrayList;
import javax.annotation.Nonnull;
/** /**
* A generic interface for combiners. Combiners are objects that transform chains of input events * A generic interface for combiners. Combiners are objects that transform chains of input events
* into committable strings and manage feedback to show to the user on the combining state. * into committable strings and manage feedback to show to the user on the combining state.
@ -35,7 +33,6 @@ public interface Combiner {
* @param event the event to combine with the existing state. * @param event the event to combine with the existing state.
* @return the resulting event. * @return the resulting event.
*/ */
@Nonnull
Event processEvent(ArrayList<Event> previousEvents, Event event); Event processEvent(ArrayList<Event> previousEvents, Event event);
/** /**

View file

@ -24,8 +24,6 @@ import com.android.inputmethod.latin.Constants;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import javax.annotation.Nonnull;
/** /**
* This class implements the logic chain between receiving events and generating code points. * This class implements the logic chain between receiving events and generating code points.
* *
@ -89,7 +87,6 @@ public class CombinerChain {
* @return the processed event. It may be the same event, or a consumed event, or a completely * @return the processed event. It may be the same event, or a consumed event, or a completely
* new event. However it may never be null. * new event. However it may never be null.
*/ */
@Nonnull
public Event processEvent(final ArrayList<Event> previousEvents, final Event newEvent) { public Event processEvent(final ArrayList<Event> previousEvents, final Event newEvent) {
final ArrayList<Event> modifiablePreviousEvents = new ArrayList<>(previousEvents); final ArrayList<Event> modifiablePreviousEvents = new ArrayList<>(previousEvents);
Event event = newEvent; Event event = newEvent;
@ -97,6 +94,10 @@ public class CombinerChain {
// A combiner can never return more than one event; it can return several // A combiner can never return more than one event; it can return several
// code points, but they should be encapsulated within one event. // code points, but they should be encapsulated within one event.
event = combiner.processEvent(modifiablePreviousEvents, event); event = combiner.processEvent(modifiablePreviousEvents, event);
if (null == event) {
// Combiners return null if they eat the event.
break;
}
} }
return event; return event;
} }

View file

@ -23,8 +23,6 @@ import com.android.inputmethod.latin.Constants;
import java.util.ArrayList; import java.util.ArrayList;
import javax.annotation.Nonnull;
/** /**
* A combiner that handles dead keys. * A combiner that handles dead keys.
*/ */
@ -33,7 +31,6 @@ public class DeadKeyCombiner implements Combiner {
final StringBuilder mDeadSequence = new StringBuilder(); final StringBuilder mDeadSequence = new StringBuilder();
@Override @Override
@Nonnull
public Event processEvent(final ArrayList<Event> previousEvents, final Event event) { public Event processEvent(final ArrayList<Event> previousEvents, final Event event) {
if (TextUtils.isEmpty(mDeadSequence)) { if (TextUtils.isEmpty(mDeadSequence)) {
if (event.isDead()) { if (event.isDead()) {

View file

@ -21,8 +21,6 @@ import com.android.inputmethod.latin.Constants;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import javax.annotation.Nonnull;
/** /**
* A combiner that reorders input for Myanmar. * A combiner that reorders input for Myanmar.
*/ */
@ -130,7 +128,6 @@ public class MyanmarReordering implements Combiner {
: Event.createSoftwareTextEvent(combinedText, Event.NOT_A_KEY_CODE); : Event.createSoftwareTextEvent(combinedText, Event.NOT_A_KEY_CODE);
} }
@Nonnull
@Override @Override
public Event processEvent(ArrayList<Event> previousEvents, Event newEvent) { public Event processEvent(ArrayList<Event> previousEvents, Event newEvent) {
final int codePoint = newEvent.mCodePoint; final int codePoint = newEvent.mCodePoint;

View file

@ -25,8 +25,6 @@ import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import javax.annotation.Nonnull;
/** /**
* A place to store the currently composing word with information such as adjacent key codes as well * A place to store the currently composing word with information such as adjacent key codes as well
*/ */
@ -181,7 +179,6 @@ public final class WordComposer {
* @param event the unprocessed event. * @param event the unprocessed event.
* @return the processed event. Never null, but may be marked as consumed. * @return the processed event. Never null, but may be marked as consumed.
*/ */
@Nonnull
public Event processEvent(final Event event) { public Event processEvent(final Event event) {
final Event processedEvent = mCombinerChain.processEvent(mEvents, event); final Event processedEvent = mCombinerChain.processEvent(mEvents, event);
mEvents.add(event); mEvents.add(event);