Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix: replace Enum.values() with Enum.entries
Browse files Browse the repository at this point in the history
  • Loading branch information
msfjarvis committed Nov 30, 2023
1 parent 14cc25a commit 7475f2f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ enum class DirectoryStructure(val value: String) {

val DEFAULT = FileBased

private val reverseMap = values().associateBy { it.value }
private val reverseMap = entries.associateBy { it.value }

fun fromValue(value: String?) = if (value != null) reverseMap[value] ?: DEFAULT else DEFAULT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ object SshKey {

companion object {

fun fromValue(value: String?): Type? = values().associateBy { it.value }[value]
fun fromValue(value: String?): Type? = entries.associateBy { it.value }[value]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AutocryptPeerUpdate() : Parcelable {
private constructor(source: Parcel, version: Int) : this() {
keyData = source.createByteArray()
effectiveDate = if (source.readInt() != 0) Date(source.readLong()) else null
preferEncrypt = PreferEncrypt.values()[source.readInt()]
preferEncrypt = PreferEncrypt.entries[source.readInt()]
}

public fun createAutocryptPeerUpdate(keyData: ByteArray?, timestamp: Date?): AutocryptPeerUpdate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class OpenPgpSignatureResult : Parcelable {
// backward compatibility for this exact version
if (version > 2) {
senderStatusResult =
readEnumWithNullAndFallback(source, SenderStatusResult.values(), SenderStatusResult.UNKNOWN)
readEnumWithNullAndFallback(source, SenderStatusResult.entries, SenderStatusResult.UNKNOWN)
confirmedUserIds = source.createStringArrayList()
} else {
senderStatusResult = SenderStatusResult.UNKNOWN
Expand All @@ -74,7 +74,7 @@ public class OpenPgpSignatureResult : Parcelable {
}
autocryptPeerentityResult =
if (version > 4) {
readEnumWithNullAndFallback(source, AutocryptPeerResult.values(), null)
readEnumWithNullAndFallback(source, AutocryptPeerResult.entries, null)
} else {
null
}
Expand Down
2 changes: 1 addition & 1 deletion ssh/src/main/kotlin/app/passwordstore/ssh/SSHKeyType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public enum class SSHKeyType(internal val value: String) {

public companion object {

public fun fromValue(type: String?): SSHKeyType? = values().associateBy { it.value }[type]
public fun fromValue(type: String?): SSHKeyType? = entries.associateBy { it.value }[type]
}
}

0 comments on commit 7475f2f

Please sign in to comment.