From f0ee1221cbc36fcb12699efca43a7d426066d4bd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 14:25:33 +0000 Subject: [PATCH] refactor(dns-cache): drop `data` from DnsCacheRecord MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auto-generated equals/hashCode would compare the ByteArray-list of addresses by reference identity — a footgun no caller needs. No code uses ==, copy, componentN, or hashing on records, so the class is now plain with no synthesized methods. --- .../com/vitorpamplona/amethyst/service/okhttp/SurgeDns.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDns.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDns.kt index d273ff82ab..16de1276d8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDns.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDns.kt @@ -342,8 +342,12 @@ class SurgeDns( * Persistable record. Addresses are stored as raw bytes (4 or 16) so [SurgeDnsStore] can write * them straight into the binary blob and round-trip through [InetAddress.getByAddress] without * formatting/parsing a string literal on either side. + * + * Not a `data class`: the auto-generated `equals`/`hashCode` would compare `addresses` + * (List) by reference identity, which is a footgun. Nothing in this codebase needs + * structural equality on records, so the methods are simply not provided. */ -data class DnsCacheRecord( +class DnsCacheRecord( val hostname: String, val addresses: List, val expiresAtMillis: Long,