diff options
author | 2014-10-14 12:32:49 +0000 | |
---|---|---|
committer | 2014-10-14 12:32:49 +0000 | |
commit | 59bf6872b956b68f03410e60701572adf48c69c8 (patch) | |
tree | 352f6b7afe348d292abbbaa303b45e64946a6c2f /java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java | |
parent | 04cd19e9bfc3fe726cfca235958d4ed48bb904d4 (diff) | |
parent | 296b11503e1dbdaceface6cfa0d5507e66792d6a (diff) | |
download | latinime-59bf6872b956b68f03410e60701572adf48c69c8.tar.gz latinime-59bf6872b956b68f03410e60701572adf48c69c8.tar.xz latinime-59bf6872b956b68f03410e60701572adf48c69c8.zip |
am 296b1150: Merge "Add JSR305 annotation to LeakGuardHandlerWrapper"
* commit '296b11503e1dbdaceface6cfa0d5507e66792d6a':
Add JSR305 annotation to LeakGuardHandlerWrapper
Diffstat (limited to 'java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java b/java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java index dd6fac671..9a5be99b3 100644 --- a/java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java +++ b/java/src/com/android/inputmethod/latin/utils/LeakGuardHandlerWrapper.java @@ -21,21 +21,22 @@ import android.os.Looper; import java.lang.ref.WeakReference; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + public class LeakGuardHandlerWrapper<T> extends Handler { private final WeakReference<T> mOwnerInstanceRef; - public LeakGuardHandlerWrapper(final T ownerInstance) { + public LeakGuardHandlerWrapper(@Nonnull final T ownerInstance) { this(ownerInstance, Looper.myLooper()); } - public LeakGuardHandlerWrapper(final T ownerInstance, final Looper looper) { + public LeakGuardHandlerWrapper(@Nonnull final T ownerInstance, final Looper looper) { super(looper); - if (ownerInstance == null) { - throw new NullPointerException("ownerInstance is null"); - } mOwnerInstanceRef = new WeakReference<>(ownerInstance); } + @Nullable public T getOwnerInstance() { return mOwnerInstanceRef.get(); } |