diff --git a/library/src/main/java/com/bumptech/glide/Registry.java b/library/src/main/java/com/bumptech/glide/Registry.java index 589eb1849f..c5903fcf2b 100644 --- a/library/src/main/java/com/bumptech/glide/Registry.java +++ b/library/src/main/java/com/bumptech/glide/Registry.java @@ -265,7 +265,9 @@ public Registry prepend( // Final to avoid a PMD error. @NonNull public final Registry setResourceDecoderBucketPriorityList(@NonNull List buckets) { - List modifiedBuckets = new ArrayList<>(buckets); + // See #3296 and https://bugs.openjdk.java.net/browse/JDK-6260652. + List modifiedBuckets = new ArrayList<>(buckets.size()); + modifiedBuckets.addAll(buckets); modifiedBuckets.add(0, BUCKET_PREPEND_ALL); modifiedBuckets.add(BUCKET_APPEND_ALL); decoderRegistry.setBucketPriorityList(modifiedBuckets);