Brais Gabin
11/21/2022, 8:36 AMThrowable with a data class. Example data class Foo(val status: Int) : IllegalStateException(). The reason is that any Throwable stores information about were it was instantiated. For that reason the equals that data class implements is missleading. Two equal instances of Foo have different behaviour. My question: do you know any source talking about this? Does a rule like this have sense to you?Javier
11/21/2022, 8:40 AMephemient
11/21/2022, 8:45 AMenableSuppression=false and writableStackTrace=false would not have extra associated state, but you probably can't easily check that up the class hierarchyBrais Gabin
11/21/2022, 8:46 AMThrowable (that's fine) the problem is to use a data class that implementes the equals.ephemient
11/21/2022, 8:46 AMdata class subclasses of any Throwable subtype by defaulteygraber
11/21/2022, 8:47 AMeygraber
11/21/2022, 8:48 AMephemient
11/21/2022, 8:48 AMdata class SafeException(override val message: String, override val cause: Throwable?) : RuntimeException(message, cause, false, false)
should be ok, but I think it's rare enough that it could be individually suppressedBrais Gabin
11/21/2022, 8:49 AMeygraber
11/21/2022, 8:52 AM