diff --git a/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideOptions.java b/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideOptions.java index b2aced03fc..cbf4c92475 100644 --- a/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideOptions.java @@ -276,102 +276,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -384,108 +401,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -494,18 +529,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -513,35 +551,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideRequest.java b/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideRequest.java index 64329582ef..376636b352 100644 --- a/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/EmptyAppGlideModuleTest/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java index e082c19ab9..b721e7f9d5 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java @@ -279,102 +279,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -387,108 +404,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -497,18 +532,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -516,35 +554,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideOptions.java index c54db9e3ec..9ece405f45 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,102 +402,119 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -489,18 +523,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -508,35 +545,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideRequest.java index 665cc9c552..3e559893c9 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtend/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -530,6 +565,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -543,6 +579,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -557,6 +594,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -571,6 +609,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -584,6 +623,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideOptions.java index 6c6962b800..ef9428d20f 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideOptions.java @@ -268,96 +268,112 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -370,108 +386,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -480,18 +514,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -499,35 +536,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideRequest.java index dea6ceff36..cac11bc08a 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideExtendMultipleArguments/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -530,6 +565,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -543,6 +579,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -557,6 +594,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -571,6 +609,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -584,6 +623,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideOptions.java index 3d3f388dbd..1ecca03187 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,102 +402,119 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -489,18 +523,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -508,35 +545,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideRequest.java index 665cc9c552..3e559893c9 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/OverrideReplace/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -530,6 +565,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -543,6 +579,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -557,6 +594,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -571,6 +609,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -584,6 +623,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java index bd449e23f4..a82df71e58 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideOptions.java index d3d5335038..7a1516c665 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionOptionsTest/StaticMethodName/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideOptions.java index d2346da25f..0faea65210 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideRequest.java b/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideRequest.java index 73a5fb86b2..f461c8ad29 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionWithOptionTest/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/GlideExtensionWithTypeTest/GlideOptions.java b/annotation/compiler/test/src/test/resources/GlideExtensionWithTypeTest/GlideOptions.java index 4443873265..0e6db8dba8 100644 --- a/annotation/compiler/test/src/test/resources/GlideExtensionWithTypeTest/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/GlideExtensionWithTypeTest/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java index 6daf49a299..e63a8c6367 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideOptions.java @@ -279,102 +279,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -387,108 +404,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -497,18 +532,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -516,35 +554,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/MemoizeStaticMethod/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideOptions.java index 89eca39ff6..0922d8cf31 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,102 +402,119 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -489,18 +523,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -508,35 +545,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideRequest.java index 665cc9c552..3e559893c9 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideExtend/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -530,6 +565,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -543,6 +579,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -557,6 +594,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -571,6 +609,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -584,6 +623,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideOptions.java index fc8c905113..2be07d97e2 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,102 +402,119 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -489,18 +523,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -508,35 +545,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideRequest.java index 665cc9c552..3e559893c9 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/OverrideReplace/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -530,6 +565,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -543,6 +579,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -557,6 +594,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -571,6 +609,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -584,6 +623,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java index 1621429573..f360cefae0 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/SkipStaticMethod/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideOptions.java index 7911b7b97c..fc9293a653 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideRequest.java index e95fd0b0b1..5533857e58 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionOptionsTest/StaticMethodName/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideOptions.java index 3887d03453..b3c4406a4e 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideRequest.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideRequest.java index 73a5fb86b2..f461c8ad29 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideRequest.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithOptionTest/GlideRequest.java @@ -71,6 +71,7 @@ protected GlideRequest getDownloadOnlyRequest() { /** * @see GlideOptions#sizeMultiplier(float) */ + @NonNull @CheckResult public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -84,6 +85,7 @@ public GlideRequest sizeMultiplier(@FloatRange(from = 0.0, to = 1 /** * @see GlideOptions#useUnlimitedSourceGeneratorsPool(boolean) */ + @NonNull @CheckResult public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -97,6 +99,7 @@ public GlideRequest useUnlimitedSourceGeneratorsPool(boolean flag /** * @see GlideOptions#useAnimationPool(boolean) */ + @NonNull @CheckResult public GlideRequest useAnimationPool(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -110,6 +113,7 @@ public GlideRequest useAnimationPool(boolean flag) { /** * @see GlideOptions#onlyRetrieveFromCache(boolean) */ + @NonNull @CheckResult public GlideRequest onlyRetrieveFromCache(boolean flag) { if (getMutableOptions() instanceof GlideOptions) { @@ -123,6 +127,7 @@ public GlideRequest onlyRetrieveFromCache(boolean flag) { /** * @see GlideOptions#diskCacheStrategy(DiskCacheStrategy) */ + @NonNull @CheckResult public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -136,6 +141,7 @@ public GlideRequest diskCacheStrategy(@NonNull DiskCacheStrategy /** * @see GlideOptions#priority(Priority) */ + @NonNull @CheckResult public GlideRequest priority(@NonNull Priority arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -149,6 +155,7 @@ public GlideRequest priority(@NonNull Priority arg0) { /** * @see GlideOptions#placeholder(Drawable) */ + @NonNull @CheckResult public GlideRequest placeholder(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -162,6 +169,7 @@ public GlideRequest placeholder(@Nullable Drawable arg0) { /** * @see GlideOptions#placeholder(int) */ + @NonNull @CheckResult public GlideRequest placeholder(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -175,6 +183,7 @@ public GlideRequest placeholder(@DrawableRes int arg0) { /** * @see GlideOptions#fallback(Drawable) */ + @NonNull @CheckResult public GlideRequest fallback(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -188,6 +197,7 @@ public GlideRequest fallback(@Nullable Drawable arg0) { /** * @see GlideOptions#fallback(int) */ + @NonNull @CheckResult public GlideRequest fallback(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -201,6 +211,7 @@ public GlideRequest fallback(@DrawableRes int arg0) { /** * @see GlideOptions#error(Drawable) */ + @NonNull @CheckResult public GlideRequest error(@Nullable Drawable arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -214,6 +225,7 @@ public GlideRequest error(@Nullable Drawable arg0) { /** * @see GlideOptions#error(int) */ + @NonNull @CheckResult public GlideRequest error(@DrawableRes int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -227,6 +239,7 @@ public GlideRequest error(@DrawableRes int arg0) { /** * @see GlideOptions#theme(Resources.Theme) */ + @NonNull @CheckResult public GlideRequest theme(@Nullable Resources.Theme arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -240,6 +253,7 @@ public GlideRequest theme(@Nullable Resources.Theme arg0) { /** * @see GlideOptions#skipMemoryCache(boolean) */ + @NonNull @CheckResult public GlideRequest skipMemoryCache(boolean skip) { if (getMutableOptions() instanceof GlideOptions) { @@ -253,6 +267,7 @@ public GlideRequest skipMemoryCache(boolean skip) { /** * @see GlideOptions#override(int, int) */ + @NonNull @CheckResult public GlideRequest override(int width, int height) { if (getMutableOptions() instanceof GlideOptions) { @@ -266,6 +281,7 @@ public GlideRequest override(int width, int height) { /** * @see GlideOptions#override(int) */ + @NonNull @CheckResult public GlideRequest override(int size) { if (getMutableOptions() instanceof GlideOptions) { @@ -279,6 +295,7 @@ public GlideRequest override(int size) { /** * @see GlideOptions#signature(Key) */ + @NonNull @CheckResult public GlideRequest signature(@NonNull Key arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -292,6 +309,7 @@ public GlideRequest signature(@NonNull Key arg0) { /** * @see GlideOptions#set(Option, T) */ + @NonNull @CheckResult public GlideRequest set(@NonNull Option arg0, @NonNull T arg1) { if (getMutableOptions() instanceof GlideOptions) { @@ -305,6 +323,7 @@ public GlideRequest set(@NonNull Option arg0, @NonNull T a /** * @see GlideOptions#decode(Class) */ + @NonNull @CheckResult public GlideRequest decode(@NonNull Class arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -318,6 +337,7 @@ public GlideRequest decode(@NonNull Class arg0) { /** * @see GlideOptions#encodeFormat(Bitmap.CompressFormat) */ + @NonNull @CheckResult public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -331,6 +351,7 @@ public GlideRequest encodeFormat(@NonNull Bitmap.CompressFormat a /** * @see GlideOptions#encodeQuality(int) */ + @NonNull @CheckResult public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -344,6 +365,7 @@ public GlideRequest encodeQuality(@IntRange(from = 0, to = 100) i /** * @see GlideOptions#frame(long) */ + @NonNull @CheckResult public GlideRequest frame(@IntRange(from = 0) long arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -357,6 +379,7 @@ public GlideRequest frame(@IntRange(from = 0) long arg0) { /** * @see GlideOptions#format(DecodeFormat) */ + @NonNull @CheckResult public GlideRequest format(@NonNull DecodeFormat arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -370,6 +393,7 @@ public GlideRequest format(@NonNull DecodeFormat arg0) { /** * @see GlideOptions#disallowHardwareConfig() */ + @NonNull @CheckResult public GlideRequest disallowHardwareConfig() { if (getMutableOptions() instanceof GlideOptions) { @@ -383,6 +407,7 @@ public GlideRequest disallowHardwareConfig() { /** * @see GlideOptions#downsample(DownsampleStrategy) */ + @NonNull @CheckResult public GlideRequest downsample(@NonNull DownsampleStrategy arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -396,6 +421,7 @@ public GlideRequest downsample(@NonNull DownsampleStrategy arg0) /** * @see GlideOptions#timeout(int) */ + @NonNull @CheckResult public GlideRequest timeout(@IntRange(from = 0) int arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -409,6 +435,7 @@ public GlideRequest timeout(@IntRange(from = 0) int arg0) { /** * @see GlideOptions#optionalCenterCrop() */ + @NonNull @CheckResult public GlideRequest optionalCenterCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -422,6 +449,7 @@ public GlideRequest optionalCenterCrop() { /** * @see GlideOptions#centerCrop() */ + @NonNull @CheckResult public GlideRequest centerCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -435,6 +463,7 @@ public GlideRequest centerCrop() { /** * @see GlideOptions#optionalFitCenter() */ + @NonNull @CheckResult public GlideRequest optionalFitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -448,6 +477,7 @@ public GlideRequest optionalFitCenter() { /** * @see GlideOptions#fitCenter() */ + @NonNull @CheckResult public GlideRequest fitCenter() { if (getMutableOptions() instanceof GlideOptions) { @@ -461,6 +491,7 @@ public GlideRequest fitCenter() { /** * @see GlideOptions#optionalCenterInside() */ + @NonNull @CheckResult public GlideRequest optionalCenterInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -474,6 +505,7 @@ public GlideRequest optionalCenterInside() { /** * @see GlideOptions#centerInside() */ + @NonNull @CheckResult public GlideRequest centerInside() { if (getMutableOptions() instanceof GlideOptions) { @@ -487,6 +519,7 @@ public GlideRequest centerInside() { /** * @see GlideOptions#optionalCircleCrop() */ + @NonNull @CheckResult public GlideRequest optionalCircleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -500,6 +533,7 @@ public GlideRequest optionalCircleCrop() { /** * @see GlideOptions#circleCrop() */ + @NonNull @CheckResult public GlideRequest circleCrop() { if (getMutableOptions() instanceof GlideOptions) { @@ -513,6 +547,7 @@ public GlideRequest circleCrop() { /** * @see GlideOptions#transform(Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -526,6 +561,7 @@ public GlideRequest transform(@NonNull Transformation arg /** * @see GlideOptions#transforms(Transformation[]) */ + @NonNull @CheckResult @SuppressWarnings({ "unchecked", @@ -543,6 +579,7 @@ public GlideRequest transforms(@NonNull Transformation... /** * @see GlideOptions#optionalTransform(Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Transformation arg0) { if (getMutableOptions() instanceof GlideOptions) { @@ -556,6 +593,7 @@ public GlideRequest optionalTransform(@NonNull Transformation, Transformation) */ + @NonNull @CheckResult public GlideRequest optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -570,6 +608,7 @@ public GlideRequest optionalTransform(@NonNull Class arg0, /** * @see GlideOptions#transform(Class, Transformation) */ + @NonNull @CheckResult public GlideRequest transform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -584,6 +623,7 @@ public GlideRequest transform(@NonNull Class arg0, /** * @see GlideOptions#dontTransform() */ + @NonNull @CheckResult public GlideRequest dontTransform() { if (getMutableOptions() instanceof GlideOptions) { @@ -597,6 +637,7 @@ public GlideRequest dontTransform() { /** * @see GlideOptions#dontAnimate() */ + @NonNull @CheckResult public GlideRequest dontAnimate() { if (getMutableOptions() instanceof GlideOptions) { diff --git a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithTypeTest/GlideOptions.java b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithTypeTest/GlideOptions.java index 4443873265..0e6db8dba8 100644 --- a/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithTypeTest/GlideOptions.java +++ b/annotation/compiler/test/src/test/resources/LegacyGlideExtensionWithTypeTest/GlideOptions.java @@ -277,102 +277,119 @@ public static GlideOptions noAnimation() { } @Override + @NonNull @CheckResult public final GlideOptions sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) { return (GlideOptions) super.sizeMultiplier(arg0); } @Override + @NonNull @CheckResult public final GlideOptions useUnlimitedSourceGeneratorsPool(boolean flag) { return (GlideOptions) super.useUnlimitedSourceGeneratorsPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions useAnimationPool(boolean flag) { return (GlideOptions) super.useAnimationPool(flag); } @Override + @NonNull @CheckResult public final GlideOptions onlyRetrieveFromCache(boolean flag) { return (GlideOptions) super.onlyRetrieveFromCache(flag); } @Override + @NonNull @CheckResult public final GlideOptions diskCacheStrategy(@NonNull DiskCacheStrategy arg0) { return (GlideOptions) super.diskCacheStrategy(arg0); } @Override + @NonNull @CheckResult public final GlideOptions priority(@NonNull Priority arg0) { return (GlideOptions) super.priority(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@Nullable Drawable arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions placeholder(@DrawableRes int arg0) { return (GlideOptions) super.placeholder(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@Nullable Drawable arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions fallback(@DrawableRes int arg0) { return (GlideOptions) super.fallback(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@Nullable Drawable arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions error(@DrawableRes int arg0) { return (GlideOptions) super.error(arg0); } @Override + @NonNull @CheckResult public final GlideOptions theme(@Nullable Resources.Theme arg0) { return (GlideOptions) super.theme(arg0); } @Override + @NonNull @CheckResult public final GlideOptions skipMemoryCache(boolean skip) { return (GlideOptions) super.skipMemoryCache(skip); } @Override + @NonNull @CheckResult public final GlideOptions override(int width, int height) { return (GlideOptions) super.override(width, height); } @Override + @NonNull @CheckResult public final GlideOptions override(int size) { return (GlideOptions) super.override(size); } @Override + @NonNull @CheckResult public final GlideOptions signature(@NonNull Key arg0) { return (GlideOptions) super.signature(arg0); @@ -385,108 +402,126 @@ public final GlideOptions clone() { } @Override + @NonNull @CheckResult public final GlideOptions set(@NonNull Option arg0, @NonNull T arg1) { return (GlideOptions) super.set(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions decode(@NonNull Class arg0) { return (GlideOptions) super.decode(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeFormat(@NonNull Bitmap.CompressFormat arg0) { return (GlideOptions) super.encodeFormat(arg0); } @Override + @NonNull @CheckResult public final GlideOptions encodeQuality(@IntRange(from = 0, to = 100) int arg0) { return (GlideOptions) super.encodeQuality(arg0); } @Override + @NonNull @CheckResult public final GlideOptions frame(@IntRange(from = 0) long arg0) { return (GlideOptions) super.frame(arg0); } @Override + @NonNull @CheckResult public final GlideOptions format(@NonNull DecodeFormat arg0) { return (GlideOptions) super.format(arg0); } @Override + @NonNull @CheckResult public final GlideOptions disallowHardwareConfig() { return (GlideOptions) super.disallowHardwareConfig(); } @Override + @NonNull @CheckResult public final GlideOptions downsample(@NonNull DownsampleStrategy arg0) { return (GlideOptions) super.downsample(arg0); } @Override + @NonNull @CheckResult public final GlideOptions timeout(@IntRange(from = 0) int arg0) { return (GlideOptions) super.timeout(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterCrop() { return (GlideOptions) super.optionalCenterCrop(); } @Override + @NonNull @CheckResult public final GlideOptions centerCrop() { return (GlideOptions) super.centerCrop(); } @Override + @NonNull @CheckResult public final GlideOptions optionalFitCenter() { return (GlideOptions) super.optionalFitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions fitCenter() { return (GlideOptions) super.fitCenter(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCenterInside() { return (GlideOptions) super.optionalCenterInside(); } @Override + @NonNull @CheckResult public final GlideOptions centerInside() { return (GlideOptions) super.centerInside(); } @Override + @NonNull @CheckResult public final GlideOptions optionalCircleCrop() { return (GlideOptions) super.optionalCircleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions circleCrop() { return (GlideOptions) super.circleCrop(); } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Transformation arg0) { return (GlideOptions) super.transform(arg0); @@ -495,18 +530,21 @@ public final GlideOptions transform(@NonNull Transformation arg0) { @Override @SafeVarargs @SuppressWarnings("varargs") + @NonNull @CheckResult public final GlideOptions transforms(@NonNull Transformation... arg0) { return (GlideOptions) super.transforms(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Transformation arg0) { return (GlideOptions) super.optionalTransform(arg0); } @Override + @NonNull @CheckResult public final GlideOptions optionalTransform(@NonNull Class arg0, @NonNull Transformation arg1) { @@ -514,35 +552,41 @@ public final GlideOptions optionalTransform(@NonNull Class arg0, } @Override + @NonNull @CheckResult public final GlideOptions transform(@NonNull Class arg0, @NonNull Transformation arg1) { return (GlideOptions) super.transform(arg0, arg1); } @Override + @NonNull @CheckResult public final GlideOptions dontTransform() { return (GlideOptions) super.dontTransform(); } @Override + @NonNull @CheckResult public final GlideOptions dontAnimate() { return (GlideOptions) super.dontAnimate(); } @Override + @NonNull @CheckResult public final GlideOptions apply(@NonNull RequestOptions arg0) { return (GlideOptions) super.apply(arg0); } @Override + @NonNull public final GlideOptions lock() { return (GlideOptions) super.lock(); } @Override + @NonNull public final GlideOptions autoClone() { return (GlideOptions) super.autoClone(); } diff --git a/library/src/main/java/com/bumptech/glide/request/RequestOptions.java b/library/src/main/java/com/bumptech/glide/request/RequestOptions.java index 3f0e2cb0da..a45a265ddd 100644 --- a/library/src/main/java/com/bumptech/glide/request/RequestOptions.java +++ b/library/src/main/java/com/bumptech/glide/request/RequestOptions.java @@ -122,6 +122,7 @@ public class RequestOptions implements Cloneable { * Returns a {@link RequestOptions} object with {@link #sizeMultiplier(float)} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions sizeMultiplierOf( @FloatRange(from = 0, to = 1) float sizeMultiplier) { @@ -131,6 +132,7 @@ public static RequestOptions sizeMultiplierOf( /** * Returns a {@link RequestOptions} object with {@link #diskCacheStrategy(DiskCacheStrategy)} set. */ + @NonNull @CheckResult public static RequestOptions diskCacheStrategyOf(@NonNull DiskCacheStrategy diskCacheStrategy) { return new RequestOptions().diskCacheStrategy(diskCacheStrategy); @@ -140,6 +142,7 @@ public static RequestOptions diskCacheStrategyOf(@NonNull DiskCacheStrategy disk * Returns a {@link RequestOptions} object with {@link #priority(Priority)}} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions priorityOf(@NonNull Priority priority) { return new RequestOptions().priority(priority); @@ -148,6 +151,7 @@ public static RequestOptions priorityOf(@NonNull Priority priority) { /** * Returns a {@link RequestOptions} object with {@link #placeholder(Drawable)} set. */ + @NonNull @CheckResult public static RequestOptions placeholderOf(@Nullable Drawable placeholder) { return new RequestOptions().placeholder(placeholder); @@ -156,6 +160,7 @@ public static RequestOptions placeholderOf(@Nullable Drawable placeholder) { /** * Returns a {@link RequestOptions} object with {@link #placeholder(int)} set. */ + @NonNull @CheckResult public static RequestOptions placeholderOf(@DrawableRes int placeholderId) { return new RequestOptions().placeholder(placeholderId); @@ -164,6 +169,7 @@ public static RequestOptions placeholderOf(@DrawableRes int placeholderId) { /** * Returns a {@link RequestOptions} object with {@link #error(Drawable)} set. */ + @NonNull @CheckResult public static RequestOptions errorOf(@Nullable Drawable errorDrawable) { return new RequestOptions().error(errorDrawable); @@ -172,6 +178,7 @@ public static RequestOptions errorOf(@Nullable Drawable errorDrawable) { /** * Returns a {@link RequestOptions} object with {@link #error(int)}} set. */ + @NonNull @CheckResult public static RequestOptions errorOf(@DrawableRes int errorId) { return new RequestOptions().error(errorId); @@ -180,6 +187,7 @@ public static RequestOptions errorOf(@DrawableRes int errorId) { /** * Returns a {@link RequestOptions} object with {@link #skipMemoryCache(boolean)} set. */ + @NonNull @CheckResult public static RequestOptions skipMemoryCacheOf(boolean skipMemoryCache) { if (skipMemoryCache) { @@ -199,6 +207,7 @@ public static RequestOptions skipMemoryCacheOf(boolean skipMemoryCache) { * Returns a {@link RequestOptions} object with {@link #override(int, int)}} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions overrideOf( @IntRange(from = 0) int width, @@ -211,6 +220,7 @@ public static RequestOptions overrideOf( * height are the given size. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions overrideOf(@IntRange(from = 0) int size) { return overrideOf(size, size); @@ -219,6 +229,7 @@ public static RequestOptions overrideOf(@IntRange(from = 0) int size) { /** * Returns a {@link RequestOptions} object with {@link #signature} set. */ + @NonNull @CheckResult public static RequestOptions signatureOf(@NonNull Key signature) { return new RequestOptions().signature(signature); @@ -227,6 +238,7 @@ public static RequestOptions signatureOf(@NonNull Key signature) { /** * Returns a {@link RequestOptions} object with {@link #fitCenter()} set. */ + @NonNull @CheckResult public static RequestOptions fitCenterTransform() { if (fitCenterOptions == null) { @@ -241,6 +253,7 @@ public static RequestOptions fitCenterTransform() { * Returns a {@link RequestOptions} object with {@link #centerInside()} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions centerInsideTransform() { if (centerInsideOptions == null) { @@ -255,6 +268,7 @@ public static RequestOptions centerInsideTransform() { * Returns a {@link RequestOptions} object with {@link #centerCrop()} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions centerCropTransform() { if (centerCropOptions == null) { @@ -269,6 +283,7 @@ public static RequestOptions centerCropTransform() { * Returns a {@link RequestOptions} object with {@link RequestOptions#circleCrop()} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions circleCropTransform() { if (circleCropOptions == null) { @@ -283,6 +298,7 @@ public static RequestOptions circleCropTransform() { * Returns a {@link RequestOptions} object with {@link #transform(Transformation)} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions bitmapTransform(@NonNull Transformation transformation) { return new RequestOptions().transform(transformation); @@ -292,6 +308,7 @@ public static RequestOptions bitmapTransform(@NonNull Transformation tra * Returns a {@link RequestOptions} object with {@link #dontTransform()} set. */ @SuppressWarnings("WeakerAccess") + @NonNull @CheckResult public static RequestOptions noTransformation() { if (noTransformOptions == null) { @@ -306,6 +323,7 @@ public static RequestOptions noTransformation() { * Returns a {@link RequestOptions} object with the given {@link Option} set via * {@link #set(Option, Object)}. */ + @NonNull @CheckResult public static RequestOptions option(@NonNull Option option, @NonNull T value) { return new RequestOptions().set(option, value); @@ -314,6 +332,7 @@ public static RequestOptions option(@NonNull Option option, @NonNull T va /** * Returns a {@link RequestOptions} object with {@link #decode(Class)} set. */ + @NonNull @CheckResult public static RequestOptions decodeTypeOf(@NonNull Class resourceClass) { return new RequestOptions().decode(resourceClass); @@ -323,6 +342,7 @@ public static RequestOptions decodeTypeOf(@NonNull Class resourceClass) { * Returns a {@link RequestOptions} object with {@link #format(DecodeFormat)} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions formatOf(@NonNull DecodeFormat format) { return new RequestOptions().format(format); @@ -332,6 +352,7 @@ public static RequestOptions formatOf(@NonNull DecodeFormat format) { * Returns a {@link RequestOptions} object with {@link #frame(long)} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions frameOf(@IntRange(from = 0) long frameTimeMicros) { return new RequestOptions().frame(frameTimeMicros); @@ -341,6 +362,7 @@ public static RequestOptions frameOf(@IntRange(from = 0) long frameTimeMicros) { * Returns a {@link RequestOptions} object with {@link #downsample(DownsampleStrategy)} set. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions downsampleOf(@NonNull DownsampleStrategy strategy) { return new RequestOptions().downsample(strategy); @@ -349,6 +371,7 @@ public static RequestOptions downsampleOf(@NonNull DownsampleStrategy strategy) /** * Returns a {@link RequestOptions} object with {@link #timeout(int)} set. */ + @NonNull @CheckResult public static RequestOptions timeoutOf(@IntRange(from = 0) int timeout) { return new RequestOptions().timeout(timeout); @@ -359,6 +382,7 @@ public static RequestOptions timeoutOf(@IntRange(from = 0) int timeout) { * #encodeQuality(int)} called with the given quality. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions encodeQualityOf(@IntRange(from = 0, to = 100) int quality) { return new RequestOptions().encodeQuality(quality); @@ -369,6 +393,7 @@ public static RequestOptions encodeQualityOf(@IntRange(from = 0, to = 100) int q * #encodeFormat(android.graphics.Bitmap.CompressFormat)} called with the given format. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions encodeFormatOf(@NonNull Bitmap.CompressFormat format) { return new RequestOptions().encodeFormat(format); @@ -379,6 +404,7 @@ public static RequestOptions encodeFormatOf(@NonNull Bitmap.CompressFormat forma * called. */ @SuppressWarnings("WeakerAccess") // Public API + @NonNull @CheckResult public static RequestOptions noAnimation() { if (noAnimationOptions == null) { @@ -403,6 +429,7 @@ private static boolean isSet(int fields, int flag) { * loading the resource. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions sizeMultiplier(@FloatRange(from = 0, to = 1) float sizeMultiplier) { if (isAutoCloneEnabled) { @@ -430,6 +457,7 @@ public RequestOptions sizeMultiplier(@FloatRange(from = 0, to = 1) float sizeMul *

If both this method and {@link #useAnimationPool(boolean)} are set, this method will be * preferred and {@link #useAnimationPool(boolean)} will be ignored. */ + @NonNull @CheckResult public RequestOptions useUnlimitedSourceGeneratorsPool(boolean flag) { if (isAutoCloneEnabled) { @@ -455,6 +483,7 @@ public RequestOptions useUnlimitedSourceGeneratorsPool(boolean flag) { * {@link #useUnlimitedSourceGeneratorsPool(boolean)} will be preferred and this method will be * ignored. */ + @NonNull @CheckResult public RequestOptions useAnimationPool(boolean flag) { if (isAutoCloneEnabled) { @@ -471,6 +500,7 @@ public RequestOptions useAnimationPool(boolean flag) { * * If set to true, will only load an item if found in the cache, and will not fetch from source. */ + @NonNull @CheckResult public RequestOptions onlyRetrieveFromCache(boolean flag) { if (isAutoCloneEnabled) { @@ -497,6 +527,7 @@ public RequestOptions onlyRetrieveFromCache(boolean flag) { * @param strategy The strategy to use. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions diskCacheStrategy(@NonNull DiskCacheStrategy strategy) { if (isAutoCloneEnabled) { @@ -514,6 +545,7 @@ public RequestOptions diskCacheStrategy(@NonNull DiskCacheStrategy strategy) { * @param priority A priority. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions priority(@NonNull Priority priority) { if (isAutoCloneEnabled) { @@ -532,6 +564,7 @@ public RequestOptions priority(@NonNull Priority priority) { * @param drawable The drawable to display as a placeholder. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions placeholder(@Nullable Drawable drawable) { if (isAutoCloneEnabled) { @@ -551,6 +584,7 @@ public RequestOptions placeholder(@Nullable Drawable drawable) { * @param resourceId The id of the resource to use as a placeholder * @return This request builder. */ + @NonNull @CheckResult public RequestOptions placeholder(@DrawableRes int resourceId) { if (isAutoCloneEnabled) { @@ -576,6 +610,7 @@ public RequestOptions placeholder(@DrawableRes int resourceId) { * @param drawable The drawable to display as a placeholder. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions fallback(@Nullable Drawable drawable) { if (isAutoCloneEnabled) { @@ -601,6 +636,7 @@ public RequestOptions fallback(@Nullable Drawable drawable) { * @param resourceId The id of the resource to use as a fallback. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions fallback(@DrawableRes int resourceId) { if (isAutoCloneEnabled) { @@ -619,6 +655,7 @@ public RequestOptions fallback(@DrawableRes int resourceId) { * @param drawable The drawable to display. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions error(@Nullable Drawable drawable) { if (isAutoCloneEnabled) { @@ -637,6 +674,7 @@ public RequestOptions error(@Nullable Drawable drawable) { * @param resourceId The id of the resource to use as a placeholder. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions error(@DrawableRes int resourceId) { if (isAutoCloneEnabled) { @@ -666,6 +704,7 @@ public RequestOptions error(@DrawableRes int resourceId) { * @param theme The theme to use when loading Drawables. * @return this request builder. */ + @NonNull @CheckResult public RequestOptions theme(@Nullable Resources.Theme theme) { if (isAutoCloneEnabled) { @@ -687,6 +726,7 @@ public RequestOptions theme(@Nullable Resources.Theme theme) { * @param skip True to allow the resource to skip the memory cache. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions skipMemoryCache(boolean skip) { if (isAutoCloneEnabled) { @@ -708,6 +748,7 @@ public RequestOptions skipMemoryCache(boolean skip) { * @param height The height in pixels to use to load the resource. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions override(int width, int height) { if (isAutoCloneEnabled) { @@ -729,6 +770,7 @@ public RequestOptions override(int width, int height) { * @param size The width and height to use. * @return This request builder. */ + @NonNull @CheckResult public RequestOptions override(int size) { return override(size, size); @@ -745,6 +787,7 @@ public RequestOptions override(int size) { * @return This request builder. * @see com.bumptech.glide.signature.ObjectKey */ + @NonNull @CheckResult public RequestOptions signature(@NonNull Key signature) { if (isAutoCloneEnabled) { @@ -785,6 +828,7 @@ public RequestOptions clone() { } } + @NonNull @CheckResult public RequestOptions set(@NonNull Option option, @NonNull T value) { if (isAutoCloneEnabled) { @@ -797,6 +841,7 @@ public RequestOptions set(@NonNull Option option, @NonNull T value) { return selfOrThrowIfLocked(); } + @NonNull @CheckResult public RequestOptions decode(@NonNull Class resourceClass) { if (isAutoCloneEnabled) { @@ -824,6 +869,7 @@ public final boolean isLocked() { * Sets the value for key * {@link com.bumptech.glide.load.resource.bitmap.BitmapEncoder#COMPRESSION_FORMAT}. */ + @NonNull @CheckResult public RequestOptions encodeFormat(@NonNull Bitmap.CompressFormat format) { return set(BitmapEncoder.COMPRESSION_FORMAT, Preconditions.checkNotNull(format)); @@ -833,6 +879,7 @@ public RequestOptions encodeFormat(@NonNull Bitmap.CompressFormat format) { * Sets the value for key * {@link BitmapEncoder#COMPRESSION_QUALITY}. */ + @NonNull @CheckResult public RequestOptions encodeQuality(@IntRange(from = 0, to = 100) int quality) { return set(BitmapEncoder.COMPRESSION_QUALITY, quality); @@ -848,6 +895,7 @@ public RequestOptions encodeQuality(@IntRange(from = 0, to = 100) int quality) { * @param frameTimeMicros The time position in microseconds of the desired frame. If negative, the * Android framework implementation return a representative frame. */ + @NonNull @CheckResult public RequestOptions frame(@IntRange(from = 0) long frameTimeMicros) { return set(VideoBitmapDecoder.TARGET_FRAME, frameTimeMicros); @@ -875,6 +923,7 @@ public RequestOptions frame(@IntRange(from = 0) long frameTimeMicros) { * @see Downsampler#DECODE_FORMAT * @see GifOptions#DECODE_FORMAT */ + @NonNull @CheckResult public RequestOptions format(@NonNull DecodeFormat format) { Preconditions.checkNotNull(format); @@ -899,6 +948,7 @@ public RequestOptions format(@NonNull DecodeFormat format) { * {@link android.graphics.Bitmap.Config#HARDWARE} cannot be drawn to * {@link android.graphics.Canvas}s, which is required by most {@link Transformation}s. */ + @NonNull @CheckResult public RequestOptions disallowHardwareConfig() { return set(Downsampler.ALLOW_HARDWARE_CONFIG, false); @@ -911,6 +961,7 @@ public RequestOptions disallowHardwareConfig() { *

This is a component option specific to {@link Downsampler}. If the defautlt Bitmap decoder * is replaced or skipped because of your configuration, this option may be ignored. */ + @NonNull @CheckResult public RequestOptions downsample(@NonNull DownsampleStrategy strategy) { return set(Downsampler.DOWNSAMPLE_STRATEGY, Preconditions.checkNotNull(strategy)); @@ -927,6 +978,7 @@ public RequestOptions downsample(@NonNull DownsampleStrategy strategy) { * @see com.bumptech.glide.load.model.stream.HttpGlideUrlLoader#TIMEOUT * @param timeoutMs The read and write timeout in milliseconds. */ + @NonNull @CheckResult public RequestOptions timeout(@IntRange(from = 0) int timeoutMs) { return set(HttpGlideUrlLoader.TIMEOUT, timeoutMs); @@ -941,6 +993,7 @@ public RequestOptions timeout(@IntRange(from = 0) int timeoutMs) { * @see #optionalTransform(Class, Transformation) * @see #centerCrop() */ + @NonNull @CheckResult public RequestOptions optionalCenterCrop() { return optionalTransform(DownsampleStrategy.CENTER_OUTSIDE, new CenterCrop()); @@ -955,6 +1008,7 @@ public RequestOptions optionalCenterCrop() { * @see #transform(Class, Transformation) * @see #optionalCenterCrop() */ + @NonNull @CheckResult public RequestOptions centerCrop() { return transform(DownsampleStrategy.CENTER_OUTSIDE, new CenterCrop()); @@ -971,6 +1025,7 @@ public RequestOptions centerCrop() { * @see #optionalTransform(Class, Transformation) * @see #fitCenter() */ + @NonNull @CheckResult public RequestOptions optionalFitCenter() { return optionalScaleOnlyTransform(DownsampleStrategy.FIT_CENTER, new FitCenter()); @@ -987,6 +1042,7 @@ public RequestOptions optionalFitCenter() { * @see #transform(Class, Transformation) * @see #optionalFitCenter() */ + @NonNull @CheckResult public RequestOptions fitCenter() { return scaleOnlyTransform(DownsampleStrategy.FIT_CENTER, new FitCenter()); @@ -1002,6 +1058,7 @@ public RequestOptions fitCenter() { * @see #optionalTransform(Class, Transformation) * @see #centerInside() */ + @NonNull @CheckResult public RequestOptions optionalCenterInside() { return optionalScaleOnlyTransform(DownsampleStrategy.CENTER_INSIDE, new CenterInside()); @@ -1017,6 +1074,7 @@ public RequestOptions optionalCenterInside() { * @see #transform(Class, Transformation) * @see #optionalCenterInside() */ + @NonNull @CheckResult public RequestOptions centerInside() { return scaleOnlyTransform(DownsampleStrategy.CENTER_INSIDE, new CenterInside()); @@ -1030,6 +1088,7 @@ public RequestOptions centerInside() { * @see #optionalTransform(Transformation) * @see #circleCrop() */ + @NonNull @CheckResult public RequestOptions optionalCircleCrop() { return optionalTransform(DownsampleStrategy.CENTER_OUTSIDE, new CircleCrop()); @@ -1044,6 +1103,7 @@ public RequestOptions optionalCircleCrop() { * @see #transform(Class, Transformation) * @see #optionalCenterCrop() */ + @NonNull @CheckResult public RequestOptions circleCrop() { return transform(DownsampleStrategy.CENTER_INSIDE, new CircleCrop()); @@ -1052,8 +1112,9 @@ public RequestOptions circleCrop() { // calling optionalTransform() on the result of clone() requires greater access. // calling downsample is guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings({"WeakerAccess", "CheckResult"}) - final RequestOptions optionalTransform(DownsampleStrategy downsampleStrategy, - Transformation transformation) { + @NonNull + final RequestOptions optionalTransform(@NonNull DownsampleStrategy downsampleStrategy, + @NonNull Transformation transformation) { if (isAutoCloneEnabled) { return clone().optionalTransform(downsampleStrategy, transformation); } @@ -1065,9 +1126,10 @@ final RequestOptions optionalTransform(DownsampleStrategy downsampleStrategy, // calling transform() on the result of clone() requires greater access. // calling downsample is guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings({"WeakerAccess", "CheckResult"}) + @NonNull @CheckResult - final RequestOptions transform(DownsampleStrategy downsampleStrategy, - Transformation transformation) { + final RequestOptions transform(@NonNull DownsampleStrategy downsampleStrategy, + @NonNull Transformation transformation) { if (isAutoCloneEnabled) { return clone().transform(downsampleStrategy, transformation); } @@ -1076,19 +1138,22 @@ final RequestOptions transform(DownsampleStrategy downsampleStrategy, return transform(transformation); } + @NonNull private RequestOptions scaleOnlyTransform( - DownsampleStrategy strategy, Transformation transformation) { + @NonNull DownsampleStrategy strategy, @NonNull Transformation transformation) { return scaleOnlyTransform(strategy, transformation, true /*isTransformationRequired*/); } + @NonNull private RequestOptions optionalScaleOnlyTransform( - DownsampleStrategy strategy, Transformation transformation) { + @NonNull DownsampleStrategy strategy, @NonNull Transformation transformation) { return scaleOnlyTransform(strategy, transformation, false /*isTransformationRequired*/); } + @NonNull private RequestOptions scaleOnlyTransform( - DownsampleStrategy strategy, - Transformation transformation, + @NonNull DownsampleStrategy strategy, + @NonNull Transformation transformation, boolean isTransformationRequired) { RequestOptions result = isTransformationRequired ? transform(strategy, transformation) : optionalTransform(strategy, transformation); @@ -1111,6 +1176,7 @@ private RequestOptions scaleOnlyTransform( */ // Guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings("CheckResult") + @NonNull @CheckResult public RequestOptions transform(@NonNull Transformation transformation) { return transform(transformation, /*isRequired=*/ true); @@ -1131,6 +1197,7 @@ public RequestOptions transform(@NonNull Transformation transformation) */ // Guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings({"unchecked", "varargs", "CheckResult"}) + @NonNull @CheckResult public RequestOptions transforms(@NonNull Transformation... transformations) { return transform(new MultiTransformation<>(transformations), /*isRequired=*/ true); @@ -1150,11 +1217,13 @@ public RequestOptions transforms(@NonNull Transformation... transformati */ // Guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings("CheckResult") + @NonNull @CheckResult public RequestOptions optionalTransform(@NonNull Transformation transformation) { return transform(transformation, /*isRequired=*/ false); } + @NonNull private RequestOptions transform( @NonNull Transformation transformation, boolean isRequired) { if (isAutoCloneEnabled) { @@ -1191,12 +1260,14 @@ private RequestOptions transform( * @param resourceClass The type of resource to transform. * @param transformation The {@link Transformation} to apply. */ + @NonNull @CheckResult public RequestOptions optionalTransform( @NonNull Class resourceClass, @NonNull Transformation transformation) { return transform(resourceClass, transformation, /*isRequired=*/ false); } + @NonNull private RequestOptions transform( @NonNull Class resourceClass, @NonNull Transformation transformation, @@ -1233,6 +1304,7 @@ private RequestOptions transform( */ // Guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings("CheckResult") + @NonNull @CheckResult public RequestOptions transform( @NonNull Class resourceClass, @NonNull Transformation transformation) { @@ -1244,6 +1316,7 @@ public RequestOptions transform( * resource classes and allows unknown resource types to be transformed without throwing an * exception. */ + @NonNull @CheckResult public RequestOptions dontTransform() { if (isAutoCloneEnabled) { @@ -1269,11 +1342,13 @@ public RequestOptions dontTransform() { */ // Guaranteed to modify the current object by the isAutoCloneEnabledCheck. @SuppressWarnings("CheckResult") + @NonNull @CheckResult public RequestOptions dontAnimate() { return set(GifOptions.DISABLE_ANIMATION, true); } + @NonNull @CheckResult public RequestOptions apply(@NonNull RequestOptions other) { if (isAutoCloneEnabled) { @@ -1419,6 +1494,7 @@ public int hashCode() { * *

Once locked, the only way to unlock is to use {@link #clone()}

*/ + @NonNull @SuppressWarnings("unchecked") public RequestOptions lock() { isLocked = true; @@ -1434,6 +1510,7 @@ public RequestOptions lock() { *

Auto clone is not retained by cloned objects returned from mutations. The cloned objects * are mutable and are not locked. */ + @NonNull public RequestOptions autoClone() { if (isLocked && !isAutoCloneEnabled) { throw new IllegalStateException("You cannot auto lock an already locked options object" @@ -1443,6 +1520,7 @@ public RequestOptions autoClone() { return lock(); } + @NonNull @SuppressWarnings("unchecked") private RequestOptions selfOrThrowIfLocked() { if (isLocked) {