Inspectopedia Help

Mutating an Immutable SharedPrefs Set

Mutating an Immutable SharedPrefs Set

As stated in the docs for SharedPreferences.getStringSet, you must not modify the set returned by getStringSet:

"Note that you <em>must not</em> modify the set instance returned by this call. The consistency of the stored data is not guaranteed if you do, nor is your ability to modify the instance at all."

Issue id: MutatingSharedPrefs

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3

Plugin:

Android, 2022.3.1 Beta 2

Last modified: 13 July 2023