okio icon indicating copy to clipboard operation
okio copied to clipboard

Apply @IgnorableReturnValue where appropriate in Okio

Open swankjesse opened this issue 1 month ago • 4 comments

swankjesse avatar Nov 06 '25 15:11 swankjesse

I’ve added @file:MustUseReturnValue to every file in the public API. (Can I do this at the module level?)

And I’ve added @IgnorableReturnValue to every function that fits. I was pretty generous with these and put them on all the overrides and expect/actuals.

I haven’t done Okio-internals for us to take advantage of this capability internally! We can do that later, with a bit less urgency.

swankjesse avatar Nov 06 '25 15:11 swankjesse

Ooooh I can save myself a lot of boilerplate with this:

kotlin {
    compilerOptions {
        freeCompilerArgs.add("-Xreturn-value-checker=full")
    }
}

Will do.

swankjesse avatar Nov 06 '25 15:11 swankjesse

  • [ ] Don’t merge this ’til we’re on Kotlin 2.3.0, since the annotations themselves are changing.

swankjesse avatar Nov 06 '25 15:11 swankjesse

I think this might end up being at odds with #1690.

Also not sure what implications it has, but the annotation has been renamed in Kotlin 2.3.0 to be plural.

JakeWharton avatar Nov 06 '25 15:11 JakeWharton