mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Fix crash when changing username on Android API < 24.
Basically, the crash was caused by using `Collections.unmodifiableList()`, which creates an `UnmodifiableCollection` wrapper around the original `List`. That `UnmodifiableCollection` wrapper contains methods that return `java.util.stream.Stream` – which was added in Java 8, but can be used on Android API < 24 through [desugaring](https://developer.android.com/studio/write/java8-support-table). _However_, it appears that when Jackson is using reflection to serialize `ReserveUsernameRequest`, it examines all of the methods of that class. This results in a `java.lang.NoClassDefFoundError: java.util.stream.Stream`, because the reflection is looking at the actual runtime `UnmodifiableCollection` class and not desugared code. As far as I can tell, that behavior is unavoidable and the only way to avoid this issue is to avoid using `Collections.unmodifiableList()` in classes that are serialized by Jackson on Android API < 24.
This commit is contained in:
committed by
Cody Henthorne
parent
dc66da0667
commit
0dfe71ca8f
@@ -2,7 +2,6 @@ package org.whispersystems.signalservice.internal.push;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ReserveUsernameRequest {
|
||||
@@ -10,7 +9,7 @@ public class ReserveUsernameRequest {
|
||||
private List<String> usernameHashes;
|
||||
|
||||
public ReserveUsernameRequest(List<String> usernameHashes) {
|
||||
this.usernameHashes = Collections.unmodifiableList(usernameHashes);
|
||||
this.usernameHashes = usernameHashes;
|
||||
}
|
||||
|
||||
List<String> getUsernameHashes() {
|
||||
|
||||
Reference in New Issue
Block a user