Rob Elliot
04/29/2021, 11:41 AM@Deprecated
but meaning specifically that a method call is pointless, because it returns this
and has the same return type as the object it is called on?
For instance, String.toString() = this
would be a candidate for it.Rob Elliot
04/29/2021, 11:43 AM= this
implementation is totally correct, but it would never make sense to call it on an instance types as the subtype.christophsturm
04/29/2021, 11:51 AMByron Katz
04/29/2021, 12:11 PMthrow IllegalAccessError()
inside a method like that, but I don't know if there is an annotation.Rob Elliot
04/29/2021, 1:22 PM"a string".toString()
. You wouldn’t want the implementation of toString
on String
to throw an exception rather than returning itself.christophsturm
04/29/2021, 1:37 PMspand
04/29/2021, 2:06 PM@Deprecated("Useless method call", replaceWith = ReplaceWith("this"), level = DeprecationLevel.ERROR)
Rob Elliot
04/29/2021, 2:08 PM@Deprecated
feels slightly semantically odd for a method that exists for good reason and that I have no intention of ever removing, and that it’s quite valid to call on the supertype.
So I was wondering if there was something more like @PointlessToCall
that had the same effect..Zach Klippenstein (he/him) [MOD]
04/29/2021, 2:15 PMRequiresOptIn
that kind of act like Deprecated.