is there a way to mark a function as part of a builder so that detekt can recognise if one forgot to end the building process?
s
schalkms
08/21/2019, 7:09 PM
Yes, you could write a custom domain-specific rule for that.
r
robstoll
08/21/2019, 7:14 PM
fair enough, I hoped detekt already has something like @CheckReturnValue
s
schalkms
08/21/2019, 7:44 PM
Nope. JSR 305 describes and provides this feature.
r
robstoll
08/21/2019, 8:54 PM
I figured JSR 305 was not really implemented in the sense of, there is no CheckReturnValue annotation in JDK, no?
Maybe I am mistaking, if so, shall I open a feature request on github that detekt supports it as well?
s
schalkms
08/22/2019, 10:15 AM
It's not part of the JDK but a reference implementation exists in one of Google's libraries. It's also part of Findbugs and Error Prone. I don't see a reason to reimplement this, because there is more than one existing solution. We strive to adhere to the DRY principle.
The following stackoverflow link gives more information regarding JSR 305.
https://stackoverflow.com/questions/2289694/what-is-the-status-of-jsr-305
HTH Markus