Skip to content

Commit

Permalink
Add missing mutable instance variables to RequestBuilder#clone
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 345719582
  • Loading branch information
sjudd authored and glide-copybara-robot committed Dec 4, 2020
1 parent e464e01 commit 332807a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion library/src/main/java/com/bumptech/glide/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ public RequestBuilder<TranscodeType> load(@Nullable byte[] model) {
* arguments, the current model is not copied so changes to the model will affect both builders.
*/
@SuppressWarnings({
"unchecked",
// we don't want to throw to be user friendly
"PMD.CloneThrowsCloneNotSupportedException"
})
Expand All @@ -654,6 +653,15 @@ public RequestBuilder<TranscodeType> load(@Nullable byte[] model) {
public RequestBuilder<TranscodeType> clone() {
RequestBuilder<TranscodeType> result = super.clone();
result.transitionOptions = result.transitionOptions.clone();
if (result.requestListeners != null) {
result.requestListeners = new ArrayList<>(result.requestListeners);
}
if (result.thumbnailBuilder != null) {
result.thumbnailBuilder = result.thumbnailBuilder.clone();
}
if (result.errorBuilder != null) {
result.errorBuilder = result.errorBuilder.clone();
}
return result;
}

Expand Down

0 comments on commit 332807a

Please sign in to comment.