{"record":{"id":"2e89c36a5edf96a6","repo":"airbnb/epoxy","slug":"please-use-value-or-code-explicitly","errorCode":null,"errorMessage":"Please use value or code explicitly","messagePattern":"Please use value or code explicitly","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"epoxy-processor/src/main/java/com/airbnb/epoxy/processor/resourcescanning/ResourceValue.kt","lineNumber":68,"sourceCode":"        if (this === other) return true\n        if (other?.javaClass != javaClass) return false\n\n        other as ResourceValue\n\n        if (value != other.value) return false\n        if (code != other.code) return false\n\n        return true\n    }\n\n    override fun hashCode(): Int {\n        var result = value\n        result = 31 * result + code.hashCode()\n        return result\n    }\n\n    override fun toString(): String {\n        throw UnsupportedOperationException(\"Please use value or code explicitly\")\n    }\n\n    fun debugDetails(): String = code.toString()\n\n    fun isStringResource(): Boolean = resourceType == \"string\"\n}\n","sourceCodeStart":50,"sourceCodeEnd":75,"githubUrl":"https://github.com/airbnb/epoxy/blob/e45bd3a61fe3a1f130e184f5b8dcf172ab99025a/epoxy-processor/src/main/java/com/airbnb/epoxy/processor/resourcescanning/ResourceValue.kt#L50-L75","documentation":"ResourceValue deliberately disables toString() by throwing UnsupportedOperationException with 'Please use value or code explicitly'. Because a ResourceValue can represent either a literal value or a generated resource code (and the processor must not accidentally interpolate an ambiguous string), the class forces callers to choose value or code explicitly, e.g. via debugDetails().","triggerScenarios":"Any code path (logging, string templates like \"$resourceValue\", error messages, assert messages, debugger evaluation) calls toString() on a ResourceValue instance from epoxy-processor's resourcescanning package.","commonSituations":"Developers hacking on the Epoxy processor add a log statement or exception message that interpolates a ResourceValue directly; or a processor crash report includes one in a message template.","solutions":["Use .value when you want the literal resource value, or .code when you want the resource code reference","Use debugDetails() for diagnostic output of the code representation","Replace string-template interpolation of ResourceValue with an explicit property in your code"],"exampleFix":"// before\nlogger.info(\"Resolved $resourceValue\")\n// after\nlogger.info(\"Resolved ${resourceValue.debugDetails()}\")","handlingStrategy":"type-guard","validationCode":"// Never interpolate a ResourceValue; pick a representation first\nif (resourceValue.isStringResource()) {\n    log(\"string resource: ${resourceValue.code}\")\n} else {\n    log(\"resource value: ${resourceValue.value}\")\n}","typeGuard":null,"tryCatchPattern":"// Only as a last-resort diagnostic wrapper\nval text = try { resourceValue.debugDetails() } catch (e: UnsupportedOperationException) { \"<ResourceValue>\" }","preventionTips":["Never use string templates (\"$rv\") on ResourceValue; IDE default toString logging triggers this throw","Use .value or .code explicitly at every call site","Prefer debugDetails() in diagnostic/logging code"],"tags":["kotlin","annotation-processor","unsupported-operation","epoxy"],"backgroundTag":"unsupported-operation","analyzedSha":"e45bd3a61fe3a1f130e184f5b8dcf172ab99025a","analyzedAt":"2026-09-13T03:24:16.052Z","contentChangedAt":"2026-09-13T03:24:16.052Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}