From 67ec9ccc4ed601c1ef2508d91e1343bd98d0e8f4 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 5 Aug 2021 03:31:32 +0430 Subject: [PATCH] mark methods as @JsonIgnore to avoid Jackson serializing them --- .../main/java/androidx/preference/ListPreference.java | 5 +++++ .../androidx/preference/MultiSelectListPreference.java | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/AndroidCompat/src/main/java/androidx/preference/ListPreference.java b/AndroidCompat/src/main/java/androidx/preference/ListPreference.java index 21178783..94517b16 100644 --- a/AndroidCompat/src/main/java/androidx/preference/ListPreference.java +++ b/AndroidCompat/src/main/java/androidx/preference/ListPreference.java @@ -9,9 +9,11 @@ package androidx.preference; import android.content.Context; import android.text.TextUtils; +import com.fasterxml.jackson.annotation.JsonIgnore; public class ListPreference extends Preference { // reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/ListPreference.java + // Note: remove @JsonIgnore and implement methods if any extension ever uses these methods or the variables behind them private CharSequence[] entries; private CharSequence[] entryValues; @@ -47,10 +49,13 @@ public class ListPreference extends Preference { this.entryValues = entryValues; } + @JsonIgnore public void setValueIndex(int index) { throw new RuntimeException("Stub!"); } + @JsonIgnore public String getValue() { throw new RuntimeException("Stub!"); } + @JsonIgnore public void setValue(String value) { throw new RuntimeException("Stub!"); } /** Tachidesk specific API */ diff --git a/AndroidCompat/src/main/java/androidx/preference/MultiSelectListPreference.java b/AndroidCompat/src/main/java/androidx/preference/MultiSelectListPreference.java index 3df8c48b..11f3bcda 100644 --- a/AndroidCompat/src/main/java/androidx/preference/MultiSelectListPreference.java +++ b/AndroidCompat/src/main/java/androidx/preference/MultiSelectListPreference.java @@ -8,24 +8,31 @@ package androidx.preference; * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import android.content.Context; +import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.Set; public class MultiSelectListPreference extends DialogPreference { + // Note: remove @JsonIgnore and implement methods if any extension ever uses these methods or the variables behind them public MultiSelectListPreference(Context context) { super(context); } + @JsonIgnore public void setEntries(CharSequence[] entries) { throw new RuntimeException("Stub!"); } - + @JsonIgnore public CharSequence[] getEntries() { throw new RuntimeException("Stub!"); } + @JsonIgnore public void setEntryValues(CharSequence[] entryValues) { throw new RuntimeException("Stub!"); } + @JsonIgnore public CharSequence[] getEntryValues() { throw new RuntimeException("Stub!"); } + @JsonIgnore public void setValues(Set values) { throw new RuntimeException("Stub!"); } + @JsonIgnore public Set getValues() { throw new RuntimeException("Stub!"); } public int findIndexOfValue(String value) { throw new RuntimeException("Stub!"); }