From c3107801dab8ccbe121157bee7dba29b7d9723e6 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Fri, 22 Dec 2017 20:34:31 -0800 Subject: [PATCH] Add nullability annotations to signature package and its dependencies (#2748) Signed-off-by: Alex Saveau --- .../main/java/com/bumptech/glide/load/Key.java | 3 ++- .../bumptech/glide/load/MultiTransformation.java | 2 +- .../java/com/bumptech/glide/load/Options.java | 3 ++- .../bumptech/glide/load/engine/DataCacheKey.java | 3 ++- .../com/bumptech/glide/load/engine/EngineKey.java | 3 ++- .../glide/load/engine/ResourceCacheKey.java | 3 ++- .../load/engine/prefill/BitmapPreFillRunner.java | 3 ++- .../com/bumptech/glide/load/model/GlideUrl.java | 3 ++- .../glide/load/resource/UnitTransformation.java | 2 +- .../bitmap/BitmapDrawableTransformation.java | 3 ++- .../glide/load/resource/bitmap/CenterCrop.java | 2 +- .../glide/load/resource/bitmap/CenterInside.java | 2 +- .../glide/load/resource/bitmap/CircleCrop.java | 2 +- .../resource/bitmap/DrawableTransformation.java | 2 +- .../glide/load/resource/bitmap/FitCenter.java | 2 +- .../load/resource/bitmap/RoundedCorners.java | 2 +- .../resource/gif/GifDrawableTransformation.java | 2 +- .../signature/ApplicationVersionSignature.java | 7 +++++-- .../bumptech/glide/signature/EmptySignature.java | 4 +++- .../glide/signature/MediaStoreSignature.java | 15 ++++++++------- .../com/bumptech/glide/signature/ObjectKey.java | 5 +++-- .../load/engine/cache/LruResourceCacheTest.java | 2 +- .../load/engine/cache/SafeKeyGeneratorTest.java | 5 +++-- .../resource/bitmap/BitmapTransformationTest.java | 14 +++++++------- 24 files changed, 55 insertions(+), 39 deletions(-) diff --git a/library/src/main/java/com/bumptech/glide/load/Key.java b/library/src/main/java/com/bumptech/glide/load/Key.java index 47bb2e01af..2e7fd07f84 100644 --- a/library/src/main/java/com/bumptech/glide/load/Key.java +++ b/library/src/main/java/com/bumptech/glide/load/Key.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load; +import android.support.annotation.NonNull; import java.nio.charset.Charset; import java.security.MessageDigest; @@ -21,7 +22,7 @@ public interface Key { *

Note - Using {@link java.security.MessageDigest#reset()} inside of this method will result * in undefined behavior.

*/ - void updateDiskCacheKey(MessageDigest messageDigest); + void updateDiskCacheKey(@NonNull MessageDigest messageDigest); @Override boolean equals(Object o); diff --git a/library/src/main/java/com/bumptech/glide/load/MultiTransformation.java b/library/src/main/java/com/bumptech/glide/load/MultiTransformation.java index 13d5e23399..18e710188d 100644 --- a/library/src/main/java/com/bumptech/glide/load/MultiTransformation.java +++ b/library/src/main/java/com/bumptech/glide/load/MultiTransformation.java @@ -64,7 +64,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { for (Transformation transformation : transformations) { transformation.updateDiskCacheKey(messageDigest); } diff --git a/library/src/main/java/com/bumptech/glide/load/Options.java b/library/src/main/java/com/bumptech/glide/load/Options.java index 434c571f92..5ca52c84b8 100644 --- a/library/src/main/java/com/bumptech/glide/load/Options.java +++ b/library/src/main/java/com/bumptech/glide/load/Options.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load; +import android.support.annotation.NonNull; import android.support.v4.util.ArrayMap; import android.support.v4.util.SimpleArrayMap; import java.security.MessageDigest; @@ -39,7 +40,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { for (int i = 0; i < values.size(); i++) { Option key = values.keyAt(i); Object value = values.valueAt(i); diff --git a/library/src/main/java/com/bumptech/glide/load/engine/DataCacheKey.java b/library/src/main/java/com/bumptech/glide/load/engine/DataCacheKey.java index b9eddb00b0..5177438a95 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/DataCacheKey.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/DataCacheKey.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.engine; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import java.security.MessageDigest; @@ -45,7 +46,7 @@ public String toString() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { sourceKey.updateDiskCacheKey(messageDigest); signature.updateDiskCacheKey(messageDigest); } diff --git a/library/src/main/java/com/bumptech/glide/load/engine/EngineKey.java b/library/src/main/java/com/bumptech/glide/load/engine/EngineKey.java index d9cbc2879e..9f16b61150 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/EngineKey.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/EngineKey.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.engine; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import com.bumptech.glide.load.Options; import com.bumptech.glide.load.Transformation; @@ -89,7 +90,7 @@ public String toString() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { throw new UnsupportedOperationException(); } } diff --git a/library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheKey.java b/library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheKey.java index 3ee4e4666c..afd18a7396 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheKey.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheKey.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.engine; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import com.bumptech.glide.load.Options; import com.bumptech.glide.load.Transformation; @@ -72,7 +73,7 @@ public int hashCode() { // TODO: Include relevant options? @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { byte[] dimensions = arrayPool.getExact(8, byte[].class); ByteBuffer.wrap(dimensions).putInt(width).putInt(height).array(); signature.updateDiskCacheKey(messageDigest); diff --git a/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillRunner.java b/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillRunner.java index 922c01afd0..34272a47d9 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillRunner.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillRunner.java @@ -4,6 +4,7 @@ import android.os.Handler; import android.os.Looper; import android.os.SystemClock; +import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import android.util.Log; import com.bumptech.glide.load.Key; @@ -165,7 +166,7 @@ private static final class UniqueKey implements Key { UniqueKey() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { throw new UnsupportedOperationException(); } } diff --git a/library/src/main/java/com/bumptech/glide/load/model/GlideUrl.java b/library/src/main/java/com/bumptech/glide/load/model/GlideUrl.java index 49892277b5..4661d3b0d3 100644 --- a/library/src/main/java/com/bumptech/glide/load/model/GlideUrl.java +++ b/library/src/main/java/com/bumptech/glide/load/model/GlideUrl.java @@ -1,6 +1,7 @@ package com.bumptech.glide.load.model; import android.net.Uri; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.text.TextUtils; import com.bumptech.glide.load.Key; @@ -120,7 +121,7 @@ public String toString() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(getCacheKeyBytes()); } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/UnitTransformation.java b/library/src/main/java/com/bumptech/glide/load/resource/UnitTransformation.java index a1f4484c72..d5da9985ee 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/UnitTransformation.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/UnitTransformation.java @@ -36,7 +36,7 @@ public Resource transform(@NonNull Context context, @NonNull Resource reso } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { // Do nothing. } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/BitmapDrawableTransformation.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/BitmapDrawableTransformation.java index ef988c86f9..b0dc28cb2c 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/BitmapDrawableTransformation.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/BitmapDrawableTransformation.java @@ -4,6 +4,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Transformation; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; @@ -90,7 +91,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { wrapped.updateDiskCacheKey(messageDigest); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterCrop.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterCrop.java index f851af4f5c..9f4df08496 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterCrop.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterCrop.java @@ -35,7 +35,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(ID_BYTES); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterInside.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterInside.java index 1cfd4f1187..b707b0fc83 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterInside.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterInside.java @@ -33,7 +33,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(ID_BYTES); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CircleCrop.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CircleCrop.java index 54bc4234d6..7d5d5968b8 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CircleCrop.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CircleCrop.java @@ -37,7 +37,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(ID_BYTES); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/DrawableTransformation.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/DrawableTransformation.java index c6afc2f0be..bcd23762d3 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/DrawableTransformation.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/DrawableTransformation.java @@ -92,7 +92,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { wrapped.updateDiskCacheKey(messageDigest); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/FitCenter.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/FitCenter.java index 995523fcda..9c2ae89c14 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/FitCenter.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/FitCenter.java @@ -31,7 +31,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(ID_BYTES); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/RoundedCorners.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/RoundedCorners.java index e9e699125e..ae55521528 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/RoundedCorners.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/RoundedCorners.java @@ -48,7 +48,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(ID_BYTES); byte[] radiusData = ByteBuffer.allocate(4).putInt(roundingRadius).array(); diff --git a/library/src/main/java/com/bumptech/glide/load/resource/gif/GifDrawableTransformation.java b/library/src/main/java/com/bumptech/glide/load/resource/gif/GifDrawableTransformation.java index 8b551ff8fe..8c39e60cb4 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/gif/GifDrawableTransformation.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/gif/GifDrawableTransformation.java @@ -81,7 +81,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { wrapped.updateDiskCacheKey(messageDigest); } } diff --git a/library/src/main/java/com/bumptech/glide/signature/ApplicationVersionSignature.java b/library/src/main/java/com/bumptech/glide/signature/ApplicationVersionSignature.java index 9d4abc5d73..2bcd360c06 100644 --- a/library/src/main/java/com/bumptech/glide/signature/ApplicationVersionSignature.java +++ b/library/src/main/java/com/bumptech/glide/signature/ApplicationVersionSignature.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import com.bumptech.glide.load.Key; import java.util.UUID; @@ -20,7 +21,8 @@ public final class ApplicationVersionSignature { * Returns the signature {@link com.bumptech.glide.load.Key} for version code of the Application * of the given Context. */ - public static Key obtain(Context context) { + @NonNull + public static Key obtain(@NonNull Context context) { String packageName = context.getPackageName(); Key result = PACKAGE_NAME_TO_KEY.get(packageName); if (result == null) { @@ -40,7 +42,8 @@ static void reset() { PACKAGE_NAME_TO_KEY.clear(); } - private static Key obtainVersionSignature(Context context) { + @NonNull + private static Key obtainVersionSignature(@NonNull Context context) { PackageInfo pInfo = null; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); diff --git a/library/src/main/java/com/bumptech/glide/signature/EmptySignature.java b/library/src/main/java/com/bumptech/glide/signature/EmptySignature.java index 93f572c0f5..2763433aad 100644 --- a/library/src/main/java/com/bumptech/glide/signature/EmptySignature.java +++ b/library/src/main/java/com/bumptech/glide/signature/EmptySignature.java @@ -1,5 +1,6 @@ package com.bumptech.glide.signature; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import java.security.MessageDigest; @@ -9,6 +10,7 @@ public final class EmptySignature implements Key { private static final EmptySignature EMPTY_KEY = new EmptySignature(); + @NonNull public static EmptySignature obtain() { return EMPTY_KEY; } @@ -23,7 +25,7 @@ public String toString() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { // Do nothing. } } diff --git a/library/src/main/java/com/bumptech/glide/signature/MediaStoreSignature.java b/library/src/main/java/com/bumptech/glide/signature/MediaStoreSignature.java index e14e1a5738..bb0e06b6e7 100644 --- a/library/src/main/java/com/bumptech/glide/signature/MediaStoreSignature.java +++ b/library/src/main/java/com/bumptech/glide/signature/MediaStoreSignature.java @@ -1,7 +1,8 @@ package com.bumptech.glide.signature; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import com.bumptech.glide.load.Key; -import com.bumptech.glide.util.Util; import java.nio.ByteBuffer; import java.security.MessageDigest; @@ -10,7 +11,7 @@ * media store files like edits, rotations, and temporary file replacement. */ public class MediaStoreSignature implements Key { - private final String mimeType; + @NonNull private final String mimeType; private final long dateModified; private final int orientation; @@ -26,8 +27,8 @@ public class MediaStoreSignature implements Key { * @param orientation The orientation of the media store media. Ok to default to 0. See {@link * android.provider.MediaStore.Images.ImageColumns#ORIENTATION}. */ - public MediaStoreSignature(String mimeType, long dateModified, int orientation) { - this.mimeType = mimeType; + public MediaStoreSignature(@Nullable String mimeType, long dateModified, int orientation) { + this.mimeType = mimeType == null ? "" : mimeType; this.dateModified = dateModified; this.orientation = orientation; } @@ -50,7 +51,7 @@ public boolean equals(Object o) { if (orientation != that.orientation) { return false; } - if (!Util.bothNullOrEqual(mimeType, that.mimeType)) { + if (!mimeType.equals(that.mimeType)) { return false; } return true; @@ -58,14 +59,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = mimeType != null ? mimeType.hashCode() : 0; + int result = mimeType.hashCode(); result = 31 * result + (int) (dateModified ^ (dateModified >>> 32)); result = 31 * result + orientation; return result; } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { byte[] data = ByteBuffer.allocate(12).putLong(dateModified).putInt(orientation).array(); messageDigest.update(data); messageDigest.update(mimeType.getBytes(CHARSET)); diff --git a/library/src/main/java/com/bumptech/glide/signature/ObjectKey.java b/library/src/main/java/com/bumptech/glide/signature/ObjectKey.java index 50ccc9f3f9..ed3ea19e85 100644 --- a/library/src/main/java/com/bumptech/glide/signature/ObjectKey.java +++ b/library/src/main/java/com/bumptech/glide/signature/ObjectKey.java @@ -1,5 +1,6 @@ package com.bumptech.glide.signature; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import com.bumptech.glide.util.Preconditions; import java.security.MessageDigest; @@ -16,7 +17,7 @@ public final class ObjectKey implements Key { private final Object object; - public ObjectKey(Object object) { + public ObjectKey(@NonNull Object object) { this.object = Preconditions.checkNotNull(object); } @@ -42,7 +43,7 @@ public int hashCode() { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(object.toString().getBytes(CHARSET)); } } diff --git a/library/src/test/java/com/bumptech/glide/load/engine/cache/LruResourceCacheTest.java b/library/src/test/java/com/bumptech/glide/load/engine/cache/LruResourceCacheTest.java index ce94ca4315..8d8e43b1fd 100644 --- a/library/src/test/java/com/bumptech/glide/load/engine/cache/LruResourceCacheTest.java +++ b/library/src/test/java/com/bumptech/glide/load/engine/cache/LruResourceCacheTest.java @@ -181,7 +181,7 @@ private Resource getResource(int size) { private static class MockKey implements Key { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(toString().getBytes(CHARSET)); } } diff --git a/library/src/test/java/com/bumptech/glide/load/engine/cache/SafeKeyGeneratorTest.java b/library/src/test/java/com/bumptech/glide/load/engine/cache/SafeKeyGeneratorTest.java index c8221b3a9c..f48c56eaad 100644 --- a/library/src/test/java/com/bumptech/glide/load/engine/cache/SafeKeyGeneratorTest.java +++ b/library/src/test/java/com/bumptech/glide/load/engine/cache/SafeKeyGeneratorTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertTrue; +import android.support.annotation.NonNull; import com.bumptech.glide.load.Key; import java.security.MessageDigest; import java.util.regex.Matcher; @@ -19,7 +20,7 @@ public class SafeKeyGeneratorTest { private int nextId; @Before - public void setUp() throws Exception { + public void setUp() { nextId = 0; keyGenerator = new SafeKeyGenerator(); } @@ -50,7 +51,7 @@ private static final class MockKey implements Key { } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { messageDigest.update(id.getBytes(CHARSET)); } } diff --git a/library/src/test/java/com/bumptech/glide/load/resource/bitmap/BitmapTransformationTest.java b/library/src/test/java/com/bumptech/glide/load/resource/bitmap/BitmapTransformationTest.java index 8c024b5b54..fefcf09788 100644 --- a/library/src/test/java/com/bumptech/glide/load/resource/bitmap/BitmapTransformationTest.java +++ b/library/src/test/java/com/bumptech/glide/load/resource/bitmap/BitmapTransformationTest.java @@ -50,7 +50,7 @@ public void tearDown() { public void testReturnsGivenResourceWhenBitmapNotTransformed() { BitmapTransformation transformation = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, @@ -68,7 +68,7 @@ public void testReturnsNewResourceWhenBitmapTransformed() { final Bitmap transformed = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_4444); BitmapTransformation transformation = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap bitmap, int outWidth, @@ -88,7 +88,7 @@ public void testPassesGivenArgumentsToTransform() { final Resource resource = mockResource(223, 4123); BitmapTransformation transformation = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, @@ -109,7 +109,7 @@ public void testThrowsIfGivenInvalidWidth() { BitmapTransformation transformation = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool bitmapPool, @NonNull Bitmap toTransform, @@ -125,7 +125,7 @@ public void testThrowsIfGivenInvalidHeight() { BitmapTransformation transformation = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool bitmapPool, @NonNull Bitmap toTransform, @@ -142,7 +142,7 @@ public void testReturnsNullIfTransformReturnsNull() { BitmapTransformation transform = new BitmapTransformation() { @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } @Override protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, @@ -197,6 +197,6 @@ protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform } @Override - public void updateDiskCacheKey(MessageDigest messageDigest) { } + public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { } } }