diff --git a/okio-assetfilesystem/src/main/kotlin/okio/assetfilesystem/AssetFileSystem.kt b/okio-assetfilesystem/src/main/kotlin/okio/assetfilesystem/AssetFileSystem.kt index b63dca2038..95f2e26887 100644 --- a/okio-assetfilesystem/src/main/kotlin/okio/assetfilesystem/AssetFileSystem.kt +++ b/okio-assetfilesystem/src/main/kotlin/okio/assetfilesystem/AssetFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio.assetfilesystem import android.content.res.AssetManager diff --git a/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt b/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt index 5ffddd4844..b7d5d90030 100644 --- a/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt +++ b/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio.fakefilesystem import kotlin.jvm.JvmName diff --git a/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FileMetadataCommon.kt b/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FileMetadataCommon.kt index 550a0cd3be..b106bb58e2 100644 --- a/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FileMetadataCommon.kt +++ b/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FileMetadataCommon.kt @@ -15,6 +15,7 @@ */ @file:JvmMultifileClass @file:JvmName("-Time") +@file:MustUseReturnValue package okio.fakefilesystem diff --git a/okio-fakefilesystem/src/jvmMain/kotlin/okio/fakefilesystem/FileMetadataJvm.kt b/okio-fakefilesystem/src/jvmMain/kotlin/okio/fakefilesystem/FileMetadataJvm.kt index eb77a30be4..8e024da2d5 100644 --- a/okio-fakefilesystem/src/jvmMain/kotlin/okio/fakefilesystem/FileMetadataJvm.kt +++ b/okio-fakefilesystem/src/jvmMain/kotlin/okio/fakefilesystem/FileMetadataJvm.kt @@ -15,6 +15,7 @@ */ @file:JvmMultifileClass @file:JvmName("-Time") +@file:MustUseReturnValue package okio.fakefilesystem diff --git a/okio-fakefilesystem/src/nonJvmMain/kotlin/okio/fakefilesystem/FileMetadataNonJvm.kt b/okio-fakefilesystem/src/nonJvmMain/kotlin/okio/fakefilesystem/FileMetadataNonJvm.kt index b4f47f9e36..df1cb900b0 100644 --- a/okio-fakefilesystem/src/nonJvmMain/kotlin/okio/fakefilesystem/FileMetadataNonJvm.kt +++ b/okio-fakefilesystem/src/nonJvmMain/kotlin/okio/fakefilesystem/FileMetadataNonJvm.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio.fakefilesystem import kotlin.time.Clock diff --git a/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSink.kt b/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSink.kt index 904adc63bf..41d5909c3b 100644 --- a/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSink.kt +++ b/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal class FileSink( diff --git a/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSource.kt b/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSource.kt index a363a9cc08..fc26e6921f 100644 --- a/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSource.kt +++ b/okio-nodefilesystem/src/commonMain/kotlin/okio/FileSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal class FileSource( diff --git a/okio-nodefilesystem/src/commonMain/kotlin/okio/FsJs.kt b/okio-nodefilesystem/src/commonMain/kotlin/okio/FsJs.kt index 223485a634..48837ed571 100644 --- a/okio-nodefilesystem/src/commonMain/kotlin/okio/FsJs.kt +++ b/okio-nodefilesystem/src/commonMain/kotlin/okio/FsJs.kt @@ -71,6 +71,7 @@ */ @file:JsModule("fs") @file:JsNonModule +@file:MustUseReturnValue package okio diff --git a/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileHandle.kt b/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileHandle.kt index 4b40d41b0f..002eca1a59 100644 --- a/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileHandle.kt +++ b/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal class NodeJsFileHandle( diff --git a/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileSystem.kt b/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileSystem.kt index 2c7cf41821..bdb0196629 100644 --- a/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileSystem.kt +++ b/okio-nodefilesystem/src/commonMain/kotlin/okio/NodeJsFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.Path.Companion.toPath diff --git a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSink.kt b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSink.kt index f3b69a1143..d20aa3f88c 100644 --- a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSink.kt +++ b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.wasm.unsafe.withScopedMemoryAllocator diff --git a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSource.kt b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSource.kt index d9d9866606..f02d78be9b 100644 --- a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSource.kt +++ b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/FileSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.wasm.unsafe.withScopedMemoryAllocator diff --git a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileHandle.kt b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileHandle.kt index 48271943dd..5d0b5007f8 100644 --- a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileHandle.kt +++ b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.wasm.unsafe.Pointer diff --git a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileSystem.kt b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileSystem.kt index 9e8202156f..f3a0a92d72 100644 --- a/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileSystem.kt +++ b/okio-wasifilesystem/src/wasmWasiMain/kotlin/okio/WasiFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.wasm.unsafe.Pointer diff --git a/okio/src/appleMain/kotlin/okio/ApplePosixVariant.kt b/okio/src/appleMain/kotlin/okio/ApplePosixVariant.kt index 8840180bc0..8f25d266bc 100644 --- a/okio/src/appleMain/kotlin/okio/ApplePosixVariant.kt +++ b/okio/src/appleMain/kotlin/okio/ApplePosixVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.alloc diff --git a/okio/src/appleMain/kotlin/okio/ByteString.kt b/okio/src/appleMain/kotlin/okio/ByteString.kt index 7d49ebd693..55746389d4 100644 --- a/okio/src/appleMain/kotlin/okio/ByteString.kt +++ b/okio/src/appleMain/kotlin/okio/ByteString.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.experimental.ExperimentalNativeApi diff --git a/okio/src/appleMain/kotlin/okio/SegmentedByteString.kt b/okio/src/appleMain/kotlin/okio/SegmentedByteString.kt index 485d834ec4..1b839331b9 100644 --- a/okio/src/appleMain/kotlin/okio/SegmentedByteString.kt +++ b/okio/src/appleMain/kotlin/okio/SegmentedByteString.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.HashFunction diff --git a/okio/src/commonMain/kotlin/okio/Base64.kt b/okio/src/commonMain/kotlin/okio/Base64.kt index b513656fca..8f36764863 100644 --- a/okio/src/commonMain/kotlin/okio/Base64.kt +++ b/okio/src/commonMain/kotlin/okio/Base64.kt @@ -15,6 +15,7 @@ * limitations under the License. */ @file:JvmName("-Base64") // A leading '-' hides this class from Java. +@file:MustUseReturnValue package okio diff --git a/okio/src/commonMain/kotlin/okio/Buffer.kt b/okio/src/commonMain/kotlin/okio/Buffer.kt index eec1bb9d61..d9709cf2a2 100644 --- a/okio/src/commonMain/kotlin/okio/Buffer.kt +++ b/okio/src/commonMain/kotlin/okio/Buffer.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** @@ -35,6 +36,7 @@ expect class Buffer() : BufferedSource, BufferedSink { internal set /** Copy `byteCount` bytes from this, starting at `offset`, to `out`. */ + @IgnorableReturnValue fun copyTo( out: Buffer, offset: Long = 0L, @@ -45,6 +47,7 @@ expect class Buffer() : BufferedSource, BufferedSink { * Overload of [copyTo] with byteCount = size - offset, work around for * https://youtrack.jetbrains.com/issue/KT-30847 */ + @IgnorableReturnValue fun copyTo( out: Buffer, offset: Long = 0L, @@ -103,13 +106,17 @@ expect class Buffer() : BufferedSource, BufferedSink { /** Returns an immutable copy of the first `byteCount` bytes of this buffer as a byte string. */ fun snapshot(byteCount: Int): ByteString + @IgnorableReturnValue fun readUnsafe(unsafeCursor: UnsafeCursor = DEFAULT__new_UnsafeCursor): UnsafeCursor + @IgnorableReturnValue fun readAndWriteUnsafe(unsafeCursor: UnsafeCursor = DEFAULT__new_UnsafeCursor): UnsafeCursor override val buffer: Buffer override fun close() + @IgnorableReturnValue override fun emit(): Buffer + @IgnorableReturnValue override fun emitCompleteSegments(): Buffer override fun exhausted(): Boolean override fun flush() @@ -127,6 +134,7 @@ expect class Buffer() : BufferedSource, BufferedSink { override fun read(sink: Buffer, byteCount: Long): Long override fun read(sink: ByteArray): Int override fun read(sink: ByteArray, offset: Int, byteCount: Int): Int + @IgnorableReturnValue override fun readAll(sink: Sink): Long override fun readByte(): Byte override fun readByteArray(): ByteArray @@ -154,24 +162,41 @@ expect class Buffer() : BufferedSource, BufferedSink { override fun select(options: Options): Int override fun select(options: TypedOptions): T? override fun timeout(): Timeout + @IgnorableReturnValue override fun write(byteString: ByteString): Buffer + @IgnorableReturnValue override fun write(byteString: ByteString, offset: Int, byteCount: Int): Buffer override fun write(source: Buffer, byteCount: Long) + @IgnorableReturnValue override fun write(source: ByteArray): Buffer + @IgnorableReturnValue override fun write(source: ByteArray, offset: Int, byteCount: Int): Buffer + @IgnorableReturnValue override fun write(source: Source, byteCount: Long): Buffer override fun writeAll(source: Source): Long + @IgnorableReturnValue override fun writeByte(b: Int): Buffer + @IgnorableReturnValue override fun writeDecimalLong(v: Long): Buffer + @IgnorableReturnValue override fun writeHexadecimalUnsignedLong(v: Long): Buffer + @IgnorableReturnValue override fun writeInt(i: Int): Buffer + @IgnorableReturnValue override fun writeIntLe(i: Int): Buffer + @IgnorableReturnValue override fun writeLong(v: Long): Buffer + @IgnorableReturnValue override fun writeLongLe(v: Long): Buffer + @IgnorableReturnValue override fun writeShort(s: Int): Buffer + @IgnorableReturnValue override fun writeShortLe(s: Int): Buffer + @IgnorableReturnValue override fun writeUtf8(string: String): Buffer + @IgnorableReturnValue override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer + @IgnorableReturnValue override fun writeUtf8CodePoint(codePoint: Int): Buffer /** @@ -385,6 +410,7 @@ expect class Buffer() : BufferedSource, BufferedSink { * the readable range (at least 1), or -1 if we have reached the end of the buffer and there are * no more bytes to read. */ + @IgnorableReturnValue fun next(): Int /** @@ -392,6 +418,7 @@ expect class Buffer() : BufferedSource, BufferedSink { * Returns the number of bytes readable in [data] (at least 1), or -1 if there are no data * to read. */ + @IgnorableReturnValue fun seek(offset: Long): Int /** @@ -410,6 +437,7 @@ expect class Buffer() : BufferedSource, BufferedSink { * * @return the previous size of the buffer. */ + @IgnorableReturnValue fun resizeBuffer(newSize: Long): Long /** @@ -434,6 +462,7 @@ expect class Buffer() : BufferedSource, BufferedSink { * than the capacity size of a single segment (8 KiB). * @return the number of bytes expanded by. Not less than `minByteCount`. */ + @IgnorableReturnValue fun expandBuffer(minByteCount: Int): Long override fun close() diff --git a/okio/src/commonMain/kotlin/okio/BufferedSink.kt b/okio/src/commonMain/kotlin/okio/BufferedSink.kt index 4f6927abb2..1b3b235876 100644 --- a/okio/src/commonMain/kotlin/okio/BufferedSink.kt +++ b/okio/src/commonMain/kotlin/okio/BufferedSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** @@ -23,23 +24,29 @@ expect sealed interface BufferedSink : Sink { /** This sink's internal buffer. */ val buffer: Buffer + @IgnorableReturnValue fun write(byteString: ByteString): BufferedSink + @IgnorableReturnValue fun write(byteString: ByteString, offset: Int, byteCount: Int): BufferedSink /** Like [OutputStream.write], this writes a complete byte array to this sink. */ + @IgnorableReturnValue fun write(source: ByteArray): BufferedSink /** Like [OutputStream.write], this writes `byteCount` bytes of `source`, starting at `offset`. */ + @IgnorableReturnValue fun write(source: ByteArray, offset: Int, byteCount: Int): BufferedSink /** * Removes all bytes from `source` and appends them to this sink. Returns the number of bytes read * which will be 0 if `source` is exhausted. */ + @IgnorableReturnValue fun writeAll(source: Source): Long /** Removes `byteCount` bytes from `source` and appends them to this sink. */ + @IgnorableReturnValue fun write(source: Source, byteCount: Long): BufferedSink /** @@ -54,6 +61,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals("Uh uh uh! You didn't say the magic word!", buffer.readUtf8()); * ``` */ + @IgnorableReturnValue fun writeUtf8(string: String): BufferedSink /** @@ -71,12 +79,15 @@ expect sealed interface BufferedSink : Sink { * assertEquals("hacker nerd hacker!", buffer.readUtf8()); * ``` */ + @IgnorableReturnValue fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): BufferedSink /** Encodes `codePoint` in UTF-8 and writes it to this sink. */ + @IgnorableReturnValue fun writeUtf8CodePoint(codePoint: Int): BufferedSink /** Writes a byte to this sink. */ + @IgnorableReturnValue fun writeByte(b: Int): BufferedSink /** @@ -95,6 +106,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeShort(s: Int): BufferedSink /** @@ -113,6 +125,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeShortLe(s: Int): BufferedSink /** @@ -135,6 +148,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeInt(i: Int): BufferedSink /** @@ -157,6 +171,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeIntLe(i: Int): BufferedSink /** @@ -187,6 +202,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeLong(v: Long): BufferedSink /** @@ -217,6 +233,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(0, buffer.size()); * ``` */ + @IgnorableReturnValue fun writeLongLe(v: Long): BufferedSink /** @@ -233,6 +250,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals("8675309 -123 1", buffer.readUtf8()); * ``` */ + @IgnorableReturnValue fun writeDecimalLong(v: Long): BufferedSink /** @@ -249,6 +267,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals("ffff cafebabe 10", buffer.readUtf8()); * ``` */ + @IgnorableReturnValue fun writeHexadecimalUnsignedLong(v: Long): BufferedSink /** @@ -299,6 +318,7 @@ expect sealed interface BufferedSink : Sink { * assertEquals(5, b0.buffer().size()); * ``` */ + @IgnorableReturnValue fun emit(): BufferedSink /** @@ -323,5 +343,6 @@ expect sealed interface BufferedSink : Sink { * assertEquals(16_384, b0.buffer().size()); // This example assumes 8192 byte segments. * ``` */ + @IgnorableReturnValue fun emitCompleteSegments(): BufferedSink } diff --git a/okio/src/commonMain/kotlin/okio/BufferedSource.kt b/okio/src/commonMain/kotlin/okio/BufferedSource.kt index 722dd274f2..18da4626e5 100644 --- a/okio/src/commonMain/kotlin/okio/BufferedSource.kt +++ b/okio/src/commonMain/kotlin/okio/BufferedSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** @@ -342,6 +343,7 @@ expect sealed interface BufferedSource : Source { * Removes all bytes from this and appends them to `sink`. Returns the total number of bytes * written to `sink` which will be 0 if this is exhausted. */ + @IgnorableReturnValue fun readAll(sink: Sink): Long /** diff --git a/okio/src/commonMain/kotlin/okio/ByteString.kt b/okio/src/commonMain/kotlin/okio/ByteString.kt index d482ad9a38..6c6442524d 100644 --- a/okio/src/commonMain/kotlin/okio/ByteString.kt +++ b/okio/src/commonMain/kotlin/okio/ByteString.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.jvm.JvmName diff --git a/okio/src/commonMain/kotlin/okio/CommonPlatform.kt b/okio/src/commonMain/kotlin/okio/CommonPlatform.kt index e073d0b342..5a8d8d874a 100644 --- a/okio/src/commonMain/kotlin/okio/CommonPlatform.kt +++ b/okio/src/commonMain/kotlin/okio/CommonPlatform.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:JvmName("-CommonPlatform") // A leading '-' hides this class from Java. +@file:MustUseReturnValue package okio diff --git a/okio/src/commonMain/kotlin/okio/ExperimentalFileSystem.kt b/okio/src/commonMain/kotlin/okio/ExperimentalFileSystem.kt index c5e182ebe7..2c79f18e95 100644 --- a/okio/src/commonMain/kotlin/okio/ExperimentalFileSystem.kt +++ b/okio/src/commonMain/kotlin/okio/ExperimentalFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.DeprecationLevel.HIDDEN diff --git a/okio/src/commonMain/kotlin/okio/FileHandle.kt b/okio/src/commonMain/kotlin/okio/FileHandle.kt index d05c3c9939..28193dc914 100644 --- a/okio/src/commonMain/kotlin/okio/FileHandle.kt +++ b/okio/src/commonMain/kotlin/okio/FileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/FileMetadata.kt b/okio/src/commonMain/kotlin/okio/FileMetadata.kt index ede70e6f6f..85a18e5a6a 100644 --- a/okio/src/commonMain/kotlin/okio/FileMetadata.kt +++ b/okio/src/commonMain/kotlin/okio/FileMetadata.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.reflect.KClass diff --git a/okio/src/commonMain/kotlin/okio/FileSystem.kt b/okio/src/commonMain/kotlin/okio/FileSystem.kt index 5797e17b9c..b95b71e508 100644 --- a/okio/src/commonMain/kotlin/okio/FileSystem.kt +++ b/okio/src/commonMain/kotlin/okio/FileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/ForwardingFileSystem.kt b/okio/src/commonMain/kotlin/okio/ForwardingFileSystem.kt index cdacb80bc6..9d23719f6c 100644 --- a/okio/src/commonMain/kotlin/okio/ForwardingFileSystem.kt +++ b/okio/src/commonMain/kotlin/okio/ForwardingFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.jvm.JvmName diff --git a/okio/src/commonMain/kotlin/okio/ForwardingSource.kt b/okio/src/commonMain/kotlin/okio/ForwardingSource.kt index 0b3e9f6aa7..5f52345cdc 100644 --- a/okio/src/commonMain/kotlin/okio/ForwardingSource.kt +++ b/okio/src/commonMain/kotlin/okio/ForwardingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** A [Source] which forwards calls to another. Useful for subclassing. */ diff --git a/okio/src/commonMain/kotlin/okio/HashingSink.kt b/okio/src/commonMain/kotlin/okio/HashingSink.kt index 19431698f5..9f105350fe 100644 --- a/okio/src/commonMain/kotlin/okio/HashingSink.kt +++ b/okio/src/commonMain/kotlin/okio/HashingSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/HashingSource.kt b/okio/src/commonMain/kotlin/okio/HashingSource.kt index 95bfe91a32..54d5ab689d 100644 --- a/okio/src/commonMain/kotlin/okio/HashingSource.kt +++ b/okio/src/commonMain/kotlin/okio/HashingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/Okio.kt b/okio/src/commonMain/kotlin/okio/Okio.kt index e113531706..50f6d0363d 100644 --- a/okio/src/commonMain/kotlin/okio/Okio.kt +++ b/okio/src/commonMain/kotlin/okio/Okio.kt @@ -17,6 +17,7 @@ /** Essential APIs for working with Okio. */ @file:JvmMultifileClass @file:JvmName("Okio") +@file:MustUseReturnValue package okio diff --git a/okio/src/commonMain/kotlin/okio/Options.kt b/okio/src/commonMain/kotlin/okio/Options.kt index 8e8b4c4a02..a97d21e0fa 100644 --- a/okio/src/commonMain/kotlin/okio/Options.kt +++ b/okio/src/commonMain/kotlin/okio/Options.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.jvm.JvmStatic diff --git a/okio/src/commonMain/kotlin/okio/Path.kt b/okio/src/commonMain/kotlin/okio/Path.kt index 337abac7ab..912c2e8a94 100644 --- a/okio/src/commonMain/kotlin/okio/Path.kt +++ b/okio/src/commonMain/kotlin/okio/Path.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.Path.Companion.toPath diff --git a/okio/src/commonMain/kotlin/okio/PeekSource.kt b/okio/src/commonMain/kotlin/okio/PeekSource.kt index 70f8ef9271..4ca0c148bf 100644 --- a/okio/src/commonMain/kotlin/okio/PeekSource.kt +++ b/okio/src/commonMain/kotlin/okio/PeekSource.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/RealBufferedSink.kt b/okio/src/commonMain/kotlin/okio/RealBufferedSink.kt index 65554cbc24..543ee8ed83 100644 --- a/okio/src/commonMain/kotlin/okio/RealBufferedSink.kt +++ b/okio/src/commonMain/kotlin/okio/RealBufferedSink.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio internal expect class RealBufferedSink( @@ -24,27 +25,47 @@ internal expect class RealBufferedSink( override val buffer: Buffer override fun close() + @IgnorableReturnValue override fun emit(): BufferedSink + @IgnorableReturnValue override fun emitCompleteSegments(): BufferedSink override fun flush() override fun timeout(): Timeout + @IgnorableReturnValue override fun write(byteString: ByteString): BufferedSink + @IgnorableReturnValue override fun write(byteString: ByteString, offset: Int, byteCount: Int): BufferedSink override fun write(source: Buffer, byteCount: Long) + @IgnorableReturnValue override fun write(source: ByteArray): BufferedSink + @IgnorableReturnValue override fun write(source: ByteArray, offset: Int, byteCount: Int): BufferedSink + @IgnorableReturnValue override fun write(source: Source, byteCount: Long): BufferedSink + @IgnorableReturnValue override fun writeAll(source: Source): Long + @IgnorableReturnValue override fun writeByte(b: Int): BufferedSink + @IgnorableReturnValue override fun writeDecimalLong(v: Long): BufferedSink + @IgnorableReturnValue override fun writeHexadecimalUnsignedLong(v: Long): BufferedSink + @IgnorableReturnValue override fun writeInt(i: Int): BufferedSink + @IgnorableReturnValue override fun writeIntLe(i: Int): BufferedSink + @IgnorableReturnValue override fun writeLong(v: Long): BufferedSink + @IgnorableReturnValue override fun writeLongLe(v: Long): BufferedSink + @IgnorableReturnValue override fun writeShort(s: Int): BufferedSink + @IgnorableReturnValue override fun writeShortLe(s: Int): BufferedSink + @IgnorableReturnValue override fun writeUtf8(string: String): BufferedSink + @IgnorableReturnValue override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): BufferedSink + @IgnorableReturnValue override fun writeUtf8CodePoint(codePoint: Int): BufferedSink } diff --git a/okio/src/commonMain/kotlin/okio/RealBufferedSource.kt b/okio/src/commonMain/kotlin/okio/RealBufferedSource.kt index a90d67610a..302133445e 100644 --- a/okio/src/commonMain/kotlin/okio/RealBufferedSource.kt +++ b/okio/src/commonMain/kotlin/okio/RealBufferedSource.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio internal expect class RealBufferedSource( diff --git a/okio/src/commonMain/kotlin/okio/Segment.kt b/okio/src/commonMain/kotlin/okio/Segment.kt index 3a34c59f1b..276fa1bdea 100644 --- a/okio/src/commonMain/kotlin/okio/Segment.kt +++ b/okio/src/commonMain/kotlin/okio/Segment.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.jvm.JvmField diff --git a/okio/src/commonMain/kotlin/okio/SegmentPool.kt b/okio/src/commonMain/kotlin/okio/SegmentPool.kt index f21c7a29fb..3c3b75a965 100644 --- a/okio/src/commonMain/kotlin/okio/SegmentPool.kt +++ b/okio/src/commonMain/kotlin/okio/SegmentPool.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/SegmentedByteString.kt b/okio/src/commonMain/kotlin/okio/SegmentedByteString.kt index 1eb5628e05..136ab243aa 100644 --- a/okio/src/commonMain/kotlin/okio/SegmentedByteString.kt +++ b/okio/src/commonMain/kotlin/okio/SegmentedByteString.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/Sink.kt b/okio/src/commonMain/kotlin/okio/Sink.kt index 0a6af54ab7..642e9f022a 100644 --- a/okio/src/commonMain/kotlin/okio/Sink.kt +++ b/okio/src/commonMain/kotlin/okio/Sink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/Socket.kt b/okio/src/commonMain/kotlin/okio/Socket.kt index a9c067198d..7eee26042d 100644 --- a/okio/src/commonMain/kotlin/okio/Socket.kt +++ b/okio/src/commonMain/kotlin/okio/Socket.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/Source.kt b/okio/src/commonMain/kotlin/okio/Source.kt index 97c668143e..723ea0aa7d 100644 --- a/okio/src/commonMain/kotlin/okio/Source.kt +++ b/okio/src/commonMain/kotlin/okio/Source.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/Timeout.kt b/okio/src/commonMain/kotlin/okio/Timeout.kt index 62600bbcc3..d96de84b39 100644 --- a/okio/src/commonMain/kotlin/okio/Timeout.kt +++ b/okio/src/commonMain/kotlin/okio/Timeout.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/commonMain/kotlin/okio/TypedOptions.kt b/okio/src/commonMain/kotlin/okio/TypedOptions.kt index 98a263132c..fd1d45078e 100644 --- a/okio/src/commonMain/kotlin/okio/TypedOptions.kt +++ b/okio/src/commonMain/kotlin/okio/TypedOptions.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.jvm.JvmStatic diff --git a/okio/src/commonMain/kotlin/okio/Utf8.kt b/okio/src/commonMain/kotlin/okio/Utf8.kt index 465a4abf76..251e98c274 100644 --- a/okio/src/commonMain/kotlin/okio/Utf8.kt +++ b/okio/src/commonMain/kotlin/okio/Utf8.kt @@ -62,6 +62,7 @@ * */ @file:JvmName("Utf8") +@file:MustUseReturnValue package okio diff --git a/okio/src/commonMain/kotlin/okio/Util.kt b/okio/src/commonMain/kotlin/okio/Util.kt index 9e6e9c50af..6c47f67b2b 100644 --- a/okio/src/commonMain/kotlin/okio/Util.kt +++ b/okio/src/commonMain/kotlin/okio/Util.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:JvmName("-SegmentedByteString") // A leading '-' hides this class from Java. +@file:MustUseReturnValue package okio diff --git a/okio/src/jsMain/kotlin/okio/FileSystem.kt b/okio/src/jsMain/kotlin/okio/FileSystem.kt index 375851f6f0..9df32c74e9 100644 --- a/okio/src/jsMain/kotlin/okio/FileSystem.kt +++ b/okio/src/jsMain/kotlin/okio/FileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.contracts.InvocationKind diff --git a/okio/src/jsMain/kotlin/okio/JsPlatform.kt b/okio/src/jsMain/kotlin/okio/JsPlatform.kt index 04350d157a..7923381b87 100644 --- a/okio/src/jsMain/kotlin/okio/JsPlatform.kt +++ b/okio/src/jsMain/kotlin/okio/JsPlatform.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /* diff --git a/okio/src/jvmMain/kotlin/okio/-DeprecatedOkio.kt b/okio/src/jvmMain/kotlin/okio/-DeprecatedOkio.kt index db94f8695b..8c19f85866 100644 --- a/okio/src/jvmMain/kotlin/okio/-DeprecatedOkio.kt +++ b/okio/src/jvmMain/kotlin/okio/-DeprecatedOkio.kt @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.File diff --git a/okio/src/jvmMain/kotlin/okio/-DeprecatedUtf8.kt b/okio/src/jvmMain/kotlin/okio/-DeprecatedUtf8.kt index 3f123c8ee0..00f4b9b652 100644 --- a/okio/src/jvmMain/kotlin/okio/-DeprecatedUtf8.kt +++ b/okio/src/jvmMain/kotlin/okio/-DeprecatedUtf8.kt @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio @Deprecated(message = "changed in Okio 2.x") diff --git a/okio/src/jvmMain/kotlin/okio/-JvmPlatform.kt b/okio/src/jvmMain/kotlin/okio/-JvmPlatform.kt index a95b242538..a3a619e5c0 100644 --- a/okio/src/jvmMain/kotlin/okio/-JvmPlatform.kt +++ b/okio/src/jvmMain/kotlin/okio/-JvmPlatform.kt @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.util.concurrent.locks.ReentrantLock diff --git a/okio/src/jvmMain/kotlin/okio/AsyncTimeout.kt b/okio/src/jvmMain/kotlin/okio/AsyncTimeout.kt index dc3c97e061..13145e285b 100644 --- a/okio/src/jvmMain/kotlin/okio/AsyncTimeout.kt +++ b/okio/src/jvmMain/kotlin/okio/AsyncTimeout.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -66,6 +67,7 @@ open class AsyncTimeout : Timeout() { } /** Returns true if the timeout occurred. */ + @IgnorableReturnValue fun exit(): Boolean { lock.withLock { val oldState = this.state diff --git a/okio/src/jvmMain/kotlin/okio/Buffer.kt b/okio/src/jvmMain/kotlin/okio/Buffer.kt index cb02d0f977..1f48f7d17a 100644 --- a/okio/src/jvmMain/kotlin/okio/Buffer.kt +++ b/okio/src/jvmMain/kotlin/okio/Buffer.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.Closeable @@ -102,8 +103,10 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { } } + @IgnorableReturnValue actual override fun emitCompleteSegments() = this // Nowhere to emit to! + @IgnorableReturnValue actual override fun emit() = this // Nowhere to emit to! actual override fun exhausted() = size == 0L @@ -174,12 +177,14 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { return this } + @IgnorableReturnValue actual fun copyTo( out: Buffer, offset: Long, byteCount: Long, ): Buffer = commonCopyTo(out, offset, byteCount) + @IgnorableReturnValue actual fun copyTo( out: Buffer, offset: Long, @@ -188,6 +193,7 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { /** Write `byteCount` bytes from this to `out`. */ @Throws(IOException::class) @JvmOverloads + @IgnorableReturnValue fun writeTo(out: OutputStream, byteCount: Long = size): Buffer { var byteCount = byteCount checkOffsetAndCount(size, 0, byteCount) @@ -214,6 +220,7 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { /** Read and exhaust bytes from `input` into this. */ @Throws(IOException::class) + @IgnorableReturnValue fun readFrom(input: InputStream): Buffer { readFrom(input, Long.MAX_VALUE, true) return this @@ -221,6 +228,7 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { /** Read `byteCount` bytes from `input` into this. */ @Throws(IOException::class) + @IgnorableReturnValue fun readFrom(input: InputStream, byteCount: Long): Buffer { require(byteCount >= 0L) { "byteCount < 0: $byteCount" } readFrom(input, byteCount, false) @@ -294,6 +302,7 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { actual override fun readFully(sink: Buffer, byteCount: Long): Unit = commonReadFully(sink, byteCount) @Throws(IOException::class) + @IgnorableReturnValue actual override fun readAll(sink: Sink): Long = commonReadAll(sink) actual override fun readUtf8() = readString(size, Charsets.UTF_8) @@ -375,19 +384,25 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { @Throws(EOFException::class) actual override fun skip(byteCount: Long) = commonSkip(byteCount) + @IgnorableReturnValue actual override fun write(byteString: ByteString): Buffer = commonWrite(byteString) + @IgnorableReturnValue actual override fun write(byteString: ByteString, offset: Int, byteCount: Int) = commonWrite(byteString, offset, byteCount) + @IgnorableReturnValue actual override fun writeUtf8(string: String): Buffer = writeUtf8(string, 0, string.length) + @IgnorableReturnValue actual override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer = commonWriteUtf8(string, beginIndex, endIndex) + @IgnorableReturnValue actual override fun writeUtf8CodePoint(codePoint: Int): Buffer = commonWriteUtf8CodePoint(codePoint) + @IgnorableReturnValue override fun writeString(string: String, charset: Charset) = writeString( string, 0, @@ -395,6 +410,7 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { charset, ) + @IgnorableReturnValue override fun writeString( string: String, beginIndex: Int, @@ -409,8 +425,10 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { return write(data, 0, data.size) } + @IgnorableReturnValue actual override fun write(source: ByteArray): Buffer = commonWrite(source) + @IgnorableReturnValue actual override fun write( source: ByteArray, offset: Int, @@ -436,34 +454,46 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { } @Throws(IOException::class) + @IgnorableReturnValue actual override fun writeAll(source: Source): Long = commonWriteAll(source) @Throws(IOException::class) + @IgnorableReturnValue actual override fun write(source: Source, byteCount: Long): Buffer = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun writeByte(b: Int): Buffer = commonWriteByte(b) + @IgnorableReturnValue actual override fun writeShort(s: Int): Buffer = commonWriteShort(s) + @IgnorableReturnValue actual override fun writeShortLe(s: Int) = writeShort(s.toShort().reverseBytes().toInt()) + @IgnorableReturnValue actual override fun writeInt(i: Int): Buffer = commonWriteInt(i) + @IgnorableReturnValue actual override fun writeIntLe(i: Int) = writeInt(i.reverseBytes()) + @IgnorableReturnValue actual override fun writeLong(v: Long): Buffer = commonWriteLong(v) + @IgnorableReturnValue actual override fun writeLongLe(v: Long) = writeLong(v.reverseBytes()) + @IgnorableReturnValue actual override fun writeDecimalLong(v: Long): Buffer = commonWriteDecimalLong(v) + @IgnorableReturnValue actual override fun writeHexadecimalUnsignedLong(v: Long): Buffer = commonWriteHexadecimalUnsignedLong(v) internal actual fun writableSegment(minimumCapacity: Int): Segment = commonWritableSegment(minimumCapacity) + @IgnorableReturnValue actual override fun write(source: Buffer, byteCount: Long): Unit = commonWrite(source, byteCount) actual override fun read(sink: Buffer, byteCount: Long): Long = commonRead(sink, byteCount) @@ -596,9 +626,11 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { actual fun snapshot(byteCount: Int): ByteString = commonSnapshot(byteCount) @JvmOverloads + @IgnorableReturnValue actual fun readUnsafe(unsafeCursor: UnsafeCursor): UnsafeCursor = commonReadUnsafe(unsafeCursor) @JvmOverloads + @IgnorableReturnValue actual fun readAndWriteUnsafe(unsafeCursor: UnsafeCursor): UnsafeCursor = commonReadAndWriteUnsafe(unsafeCursor) @@ -633,12 +665,16 @@ actual class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel { @JvmField actual var end = -1 + @IgnorableReturnValue actual fun next(): Int = commonNext() + @IgnorableReturnValue actual fun seek(offset: Long): Int = commonSeek(offset) + @IgnorableReturnValue actual fun resizeBuffer(newSize: Long): Long = commonResizeBuffer(newSize) + @IgnorableReturnValue actual fun expandBuffer(minByteCount: Int): Long = commonExpandBuffer(minByteCount) actual override fun close() { diff --git a/okio/src/jvmMain/kotlin/okio/BufferedSink.kt b/okio/src/jvmMain/kotlin/okio/BufferedSink.kt index fd124a4eac..5b66bfc683 100644 --- a/okio/src/jvmMain/kotlin/okio/BufferedSink.kt +++ b/okio/src/jvmMain/kotlin/okio/BufferedSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -32,72 +33,94 @@ actual sealed interface BufferedSink : Sink, WritableByteChannel { actual val buffer: Buffer @Throws(IOException::class) + @IgnorableReturnValue actual fun write(byteString: ByteString): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun write(byteString: ByteString, offset: Int, byteCount: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun write(source: ByteArray): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun write(source: ByteArray, offset: Int, byteCount: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeAll(source: Source): Long @Throws(IOException::class) + @IgnorableReturnValue actual fun write(source: Source, byteCount: Long): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeUtf8(string: String): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeUtf8CodePoint(codePoint: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue fun writeString(string: String, charset: Charset): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue fun writeString(string: String, beginIndex: Int, endIndex: Int, charset: Charset): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeByte(b: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeShort(s: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeShortLe(s: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeInt(i: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeIntLe(i: Int): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeLong(v: Long): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeLongLe(v: Long): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeDecimalLong(v: Long): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun writeHexadecimalUnsignedLong(v: Long): BufferedSink @Throws(IOException::class) actual override fun flush() @Throws(IOException::class) + @IgnorableReturnValue actual fun emit(): BufferedSink @Throws(IOException::class) + @IgnorableReturnValue actual fun emitCompleteSegments(): BufferedSink /** Returns an output stream that writes to this sink. */ diff --git a/okio/src/jvmMain/kotlin/okio/BufferedSource.kt b/okio/src/jvmMain/kotlin/okio/BufferedSource.kt index eeeeb527b3..a3819d059f 100644 --- a/okio/src/jvmMain/kotlin/okio/BufferedSource.kt +++ b/okio/src/jvmMain/kotlin/okio/BufferedSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -101,6 +102,7 @@ actual sealed interface BufferedSource : Source, ReadableByteChannel { actual fun readFully(sink: Buffer, byteCount: Long) @Throws(IOException::class) + @IgnorableReturnValue actual fun readAll(sink: Sink): Long @Throws(IOException::class) diff --git a/okio/src/jvmMain/kotlin/okio/ByteString.kt b/okio/src/jvmMain/kotlin/okio/ByteString.kt index 37922adfed..196a410142 100644 --- a/okio/src/jvmMain/kotlin/okio/ByteString.kt +++ b/okio/src/jvmMain/kotlin/okio/ByteString.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.EOFException diff --git a/okio/src/jvmMain/kotlin/okio/CipherSink.kt b/okio/src/jvmMain/kotlin/okio/CipherSink.kt index 9b5c7a92fe..40ffebe81a 100644 --- a/okio/src/jvmMain/kotlin/okio/CipherSink.kt +++ b/okio/src/jvmMain/kotlin/okio/CipherSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/CipherSource.kt b/okio/src/jvmMain/kotlin/okio/CipherSource.kt index aeb49e66df..5497653725 100644 --- a/okio/src/jvmMain/kotlin/okio/CipherSource.kt +++ b/okio/src/jvmMain/kotlin/okio/CipherSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/DeflaterSink.kt b/okio/src/jvmMain/kotlin/okio/DeflaterSink.kt index 43ed6e18ff..670e54ce7d 100644 --- a/okio/src/jvmMain/kotlin/okio/DeflaterSink.kt +++ b/okio/src/jvmMain/kotlin/okio/DeflaterSink.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:Suppress("NOTHING_TO_INLINE") // Aliases to public API. +@file:MustUseReturnValue package okio diff --git a/okio/src/jvmMain/kotlin/okio/DeprecatedUpgrade.kt b/okio/src/jvmMain/kotlin/okio/DeprecatedUpgrade.kt index 199b22fa6e..14f3f7f6db 100644 --- a/okio/src/jvmMain/kotlin/okio/DeprecatedUpgrade.kt +++ b/okio/src/jvmMain/kotlin/okio/DeprecatedUpgrade.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:JvmName("-DeprecatedUpgrade") +@file:MustUseReturnValue package okio diff --git a/okio/src/jvmMain/kotlin/okio/FileSystem.System.kt b/okio/src/jvmMain/kotlin/okio/FileSystem.System.kt index 2958eea225..7bd8f9131f 100644 --- a/okio/src/jvmMain/kotlin/okio/FileSystem.System.kt +++ b/okio/src/jvmMain/kotlin/okio/FileSystem.System.kt @@ -1,4 +1,20 @@ +/* + * Copyright (C) 2020 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ @file:JvmName("SystemFileSystem") +@file:MustUseReturnValue package okio diff --git a/okio/src/jvmMain/kotlin/okio/FileSystem.kt b/okio/src/jvmMain/kotlin/okio/FileSystem.kt index 95924f4cfd..72fb62401c 100644 --- a/okio/src/jvmMain/kotlin/okio/FileSystem.kt +++ b/okio/src/jvmMain/kotlin/okio/FileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.nio.file.FileSystem as JavaNioFileSystem diff --git a/okio/src/jvmMain/kotlin/okio/ForwardingSink.kt b/okio/src/jvmMain/kotlin/okio/ForwardingSink.kt index 060aa4ceb8..2760646c2d 100644 --- a/okio/src/jvmMain/kotlin/okio/ForwardingSink.kt +++ b/okio/src/jvmMain/kotlin/okio/ForwardingSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/ForwardingSource.kt b/okio/src/jvmMain/kotlin/okio/ForwardingSource.kt index 5be29d320e..9cc160161c 100644 --- a/okio/src/jvmMain/kotlin/okio/ForwardingSource.kt +++ b/okio/src/jvmMain/kotlin/okio/ForwardingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/ForwardingTimeout.kt b/okio/src/jvmMain/kotlin/okio/ForwardingTimeout.kt index 4516a51dd8..d98f9aeb14 100644 --- a/okio/src/jvmMain/kotlin/okio/ForwardingTimeout.kt +++ b/okio/src/jvmMain/kotlin/okio/ForwardingTimeout.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -32,6 +33,7 @@ open class ForwardingTimeout( return this } + @IgnorableReturnValue override fun timeout(timeout: Long, unit: TimeUnit) = delegate.timeout(timeout, unit) override fun timeoutNanos() = delegate.timeoutNanos() @@ -40,12 +42,15 @@ open class ForwardingTimeout( override fun deadlineNanoTime() = delegate.deadlineNanoTime() + @IgnorableReturnValue override fun deadlineNanoTime(deadlineNanoTime: Long) = delegate.deadlineNanoTime( deadlineNanoTime, ) + @IgnorableReturnValue override fun clearTimeout() = delegate.clearTimeout() + @IgnorableReturnValue override fun clearDeadline() = delegate.clearDeadline() @Throws(IOException::class) diff --git a/okio/src/jvmMain/kotlin/okio/HashingSink.kt b/okio/src/jvmMain/kotlin/okio/HashingSink.kt index 8b17867732..34678b53bd 100644 --- a/okio/src/jvmMain/kotlin/okio/HashingSink.kt +++ b/okio/src/jvmMain/kotlin/okio/HashingSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/HashingSource.kt b/okio/src/jvmMain/kotlin/okio/HashingSource.kt index 4d33558943..1fa0ba1095 100644 --- a/okio/src/jvmMain/kotlin/okio/HashingSource.kt +++ b/okio/src/jvmMain/kotlin/okio/HashingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/InflaterSource.kt b/okio/src/jvmMain/kotlin/okio/InflaterSource.kt index a07873d1ca..fbd0c282b1 100644 --- a/okio/src/jvmMain/kotlin/okio/InflaterSource.kt +++ b/okio/src/jvmMain/kotlin/okio/InflaterSource.kt @@ -15,6 +15,7 @@ */ @file:Suppress("NOTHING_TO_INLINE") // Aliases to public API. +@file:MustUseReturnValue package okio diff --git a/okio/src/jvmMain/kotlin/okio/JvmFileHandle.kt b/okio/src/jvmMain/kotlin/okio/JvmFileHandle.kt index 5a6c3b73e8..930704aa30 100644 --- a/okio/src/jvmMain/kotlin/okio/JvmFileHandle.kt +++ b/okio/src/jvmMain/kotlin/okio/JvmFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.RandomAccessFile diff --git a/okio/src/jvmMain/kotlin/okio/JvmOkio.kt b/okio/src/jvmMain/kotlin/okio/JvmOkio.kt index 5a5b909e39..2620e942aa 100644 --- a/okio/src/jvmMain/kotlin/okio/JvmOkio.kt +++ b/okio/src/jvmMain/kotlin/okio/JvmOkio.kt @@ -17,6 +17,7 @@ /** Essential APIs for working with Okio. */ @file:JvmMultifileClass @file:JvmName("Okio") +@file:MustUseReturnValue package okio diff --git a/okio/src/jvmMain/kotlin/okio/JvmSystemFileSystem.kt b/okio/src/jvmMain/kotlin/okio/JvmSystemFileSystem.kt index 8584dfb584..9b0f2df6d5 100644 --- a/okio/src/jvmMain/kotlin/okio/JvmSystemFileSystem.kt +++ b/okio/src/jvmMain/kotlin/okio/JvmSystemFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.InterruptedIOException diff --git a/okio/src/jvmMain/kotlin/okio/NioFileSystemFileHandle.kt b/okio/src/jvmMain/kotlin/okio/NioFileSystemFileHandle.kt index 480f41a453..295600e0f2 100644 --- a/okio/src/jvmMain/kotlin/okio/NioFileSystemFileHandle.kt +++ b/okio/src/jvmMain/kotlin/okio/NioFileSystemFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.nio.ByteBuffer diff --git a/okio/src/jvmMain/kotlin/okio/NioFileSystemWrappingFileSystem.kt b/okio/src/jvmMain/kotlin/okio/NioFileSystemWrappingFileSystem.kt index c1a3c337c4..f55b8fcd49 100644 --- a/okio/src/jvmMain/kotlin/okio/NioFileSystemWrappingFileSystem.kt +++ b/okio/src/jvmMain/kotlin/okio/NioFileSystemWrappingFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.InterruptedIOException diff --git a/okio/src/jvmMain/kotlin/okio/NioSystemFileSystem.kt b/okio/src/jvmMain/kotlin/okio/NioSystemFileSystem.kt index f4ebbced1a..aa44abd52a 100644 --- a/okio/src/jvmMain/kotlin/okio/NioSystemFileSystem.kt +++ b/okio/src/jvmMain/kotlin/okio/NioSystemFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.nio.file.FileSystemException diff --git a/okio/src/jvmMain/kotlin/okio/Path.kt b/okio/src/jvmMain/kotlin/okio/Path.kt index 1245696949..745e535aac 100644 --- a/okio/src/jvmMain/kotlin/okio/Path.kt +++ b/okio/src/jvmMain/kotlin/okio/Path.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.File diff --git a/okio/src/jvmMain/kotlin/okio/Pipe.kt b/okio/src/jvmMain/kotlin/okio/Pipe.kt index 25d9e1c3a5..90520eddb7 100644 --- a/okio/src/jvmMain/kotlin/okio/Pipe.kt +++ b/okio/src/jvmMain/kotlin/okio/Pipe.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.util.concurrent.locks.Condition diff --git a/okio/src/jvmMain/kotlin/okio/RealBufferedSink.kt b/okio/src/jvmMain/kotlin/okio/RealBufferedSink.kt index d1665ca726..8e2cf79103 100644 --- a/okio/src/jvmMain/kotlin/okio/RealBufferedSink.kt +++ b/okio/src/jvmMain/kotlin/okio/RealBufferedSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -53,21 +54,28 @@ internal actual class RealBufferedSink actual constructor( override fun buffer() = bufferField actual override fun write(source: Buffer, byteCount: Long) = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun write(byteString: ByteString) = commonWrite(byteString) + @IgnorableReturnValue actual override fun write(byteString: ByteString, offset: Int, byteCount: Int) = commonWrite(byteString, offset, byteCount) + @IgnorableReturnValue actual override fun writeUtf8(string: String) = commonWriteUtf8(string) + @IgnorableReturnValue actual override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int) = commonWriteUtf8(string, beginIndex, endIndex) + @IgnorableReturnValue actual override fun writeUtf8CodePoint(codePoint: Int) = commonWriteUtf8CodePoint(codePoint) + @IgnorableReturnValue override fun writeString(string: String, charset: Charset): BufferedSink { check(!closed) { "closed" } buffer.writeString(string, charset) return emitCompleteSegments() } + @IgnorableReturnValue override fun writeString( string: String, beginIndex: Int, @@ -79,7 +87,9 @@ internal actual class RealBufferedSink actual constructor( return emitCompleteSegments() } + @IgnorableReturnValue actual override fun write(source: ByteArray) = commonWrite(source) + @IgnorableReturnValue actual override fun write(source: ByteArray, offset: Int, byteCount: Int) = commonWrite(source, offset, byteCount) @@ -90,18 +100,31 @@ internal actual class RealBufferedSink actual constructor( return result } + @IgnorableReturnValue actual override fun writeAll(source: Source) = commonWriteAll(source) + @IgnorableReturnValue actual override fun write(source: Source, byteCount: Long): BufferedSink = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun writeByte(b: Int) = commonWriteByte(b) + @IgnorableReturnValue actual override fun writeShort(s: Int) = commonWriteShort(s) + @IgnorableReturnValue actual override fun writeShortLe(s: Int) = commonWriteShortLe(s) + @IgnorableReturnValue actual override fun writeInt(i: Int) = commonWriteInt(i) + @IgnorableReturnValue actual override fun writeIntLe(i: Int) = commonWriteIntLe(i) + @IgnorableReturnValue actual override fun writeLong(v: Long) = commonWriteLong(v) + @IgnorableReturnValue actual override fun writeLongLe(v: Long) = commonWriteLongLe(v) + @IgnorableReturnValue actual override fun writeDecimalLong(v: Long) = commonWriteDecimalLong(v) + @IgnorableReturnValue actual override fun writeHexadecimalUnsignedLong(v: Long) = commonWriteHexadecimalUnsignedLong(v) + @IgnorableReturnValue actual override fun emitCompleteSegments() = commonEmitCompleteSegments() + @IgnorableReturnValue actual override fun emit() = commonEmit() override fun outputStream(): OutputStream { diff --git a/okio/src/jvmMain/kotlin/okio/RealBufferedSource.kt b/okio/src/jvmMain/kotlin/okio/RealBufferedSource.kt index f52ad54ee6..052bc46c11 100644 --- a/okio/src/jvmMain/kotlin/okio/RealBufferedSource.kt +++ b/okio/src/jvmMain/kotlin/okio/RealBufferedSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/SegmentPool.kt b/okio/src/jvmMain/kotlin/okio/SegmentPool.kt index 4a05478c6b..197f3e221e 100644 --- a/okio/src/jvmMain/kotlin/okio/SegmentPool.kt +++ b/okio/src/jvmMain/kotlin/okio/SegmentPool.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.util.concurrent.atomic.AtomicReference diff --git a/okio/src/jvmMain/kotlin/okio/SegmentedByteString.kt b/okio/src/jvmMain/kotlin/okio/SegmentedByteString.kt index fe64afdba5..eab5480792 100644 --- a/okio/src/jvmMain/kotlin/okio/SegmentedByteString.kt +++ b/okio/src/jvmMain/kotlin/okio/SegmentedByteString.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/Sink.kt b/okio/src/jvmMain/kotlin/okio/Sink.kt index e93ffb5216..6142cb46b5 100644 --- a/okio/src/jvmMain/kotlin/okio/Sink.kt +++ b/okio/src/jvmMain/kotlin/okio/Sink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.Closeable diff --git a/okio/src/jvmMain/kotlin/okio/Throttler.kt b/okio/src/jvmMain/kotlin/okio/Throttler.kt index 859fb71606..9846c29ec0 100644 --- a/okio/src/jvmMain/kotlin/okio/Throttler.kt +++ b/okio/src/jvmMain/kotlin/okio/Throttler.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException diff --git a/okio/src/jvmMain/kotlin/okio/Timeout.kt b/okio/src/jvmMain/kotlin/okio/Timeout.kt index 962bdbdbf6..7d0b0fd6ca 100644 --- a/okio/src/jvmMain/kotlin/okio/Timeout.kt +++ b/okio/src/jvmMain/kotlin/okio/Timeout.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import java.io.IOException @@ -46,6 +47,7 @@ actual open class Timeout { * If `timeout == 0`, operations will run indefinitely. (Operating system timeouts may still * apply.) */ + @IgnorableReturnValue open fun timeout(timeout: Long, unit: TimeUnit): Timeout { require(timeout >= 0) { "timeout < 0: $timeout" } timeoutNanos = unit.toNanos(timeout) @@ -73,6 +75,7 @@ actual open class Timeout { * complete before this time. Use a deadline to set a maximum bound on the time spent on a * sequence of operations. */ + @IgnorableReturnValue open fun deadlineNanoTime(deadlineNanoTime: Long): Timeout { this.hasDeadline = true this.deadlineNanoTime = deadlineNanoTime @@ -80,18 +83,21 @@ actual open class Timeout { } /** Set a deadline of now plus `duration` time. */ + @IgnorableReturnValue fun deadline(duration: Long, unit: TimeUnit): Timeout { require(duration > 0) { "duration <= 0: $duration" } return deadlineNanoTime(System.nanoTime() + unit.toNanos(duration)) } /** Clears the timeout. Operating system timeouts may still apply. */ + @IgnorableReturnValue open fun clearTimeout(): Timeout { timeoutNanos = 0 return this } /** Clears the deadline. */ + @IgnorableReturnValue open fun clearDeadline(): Timeout { hasDeadline = false return this diff --git a/okio/src/linuxMain/kotlin/okio/LinuxPosixVariant.kt b/okio/src/linuxMain/kotlin/okio/LinuxPosixVariant.kt index 168d0ddc11..ed88969d6e 100644 --- a/okio/src/linuxMain/kotlin/okio/LinuxPosixVariant.kt +++ b/okio/src/linuxMain/kotlin/okio/LinuxPosixVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.alloc diff --git a/okio/src/mingwX64Main/kotlin/okio/Windows.kt b/okio/src/mingwX64Main/kotlin/okio/Windows.kt index 18370b9d23..988f3602bf 100644 --- a/okio/src/mingwX64Main/kotlin/okio/Windows.kt +++ b/okio/src/mingwX64Main/kotlin/okio/Windows.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.ByteVarOf diff --git a/okio/src/mingwX64Main/kotlin/okio/WindowsFileHandle.kt b/okio/src/mingwX64Main/kotlin/okio/WindowsFileHandle.kt index 79cfb7f9a8..4a27f6f0ff 100644 --- a/okio/src/mingwX64Main/kotlin/okio/WindowsFileHandle.kt +++ b/okio/src/mingwX64Main/kotlin/okio/WindowsFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CValuesRef diff --git a/okio/src/mingwX64Main/kotlin/okio/WindowsPosixVariant.kt b/okio/src/mingwX64Main/kotlin/okio/WindowsPosixVariant.kt index 21dd41a07a..de3b3daae1 100644 --- a/okio/src/mingwX64Main/kotlin/okio/WindowsPosixVariant.kt +++ b/okio/src/mingwX64Main/kotlin/okio/WindowsPosixVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/Cinterop.kt b/okio/src/nativeMain/kotlin/okio/Cinterop.kt index c5b93c9aa1..bc062fe583 100644 --- a/okio/src/nativeMain/kotlin/okio/Cinterop.kt +++ b/okio/src/nativeMain/kotlin/okio/Cinterop.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.ByteVarOf diff --git a/okio/src/nativeMain/kotlin/okio/DataProcessor.kt b/okio/src/nativeMain/kotlin/okio/DataProcessor.kt index c19e3a195b..e74c79c08e 100644 --- a/okio/src/nativeMain/kotlin/okio/DataProcessor.kt +++ b/okio/src/nativeMain/kotlin/okio/DataProcessor.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio private val emptyByteArray = byteArrayOf() diff --git a/okio/src/nativeMain/kotlin/okio/Deflater.kt b/okio/src/nativeMain/kotlin/okio/Deflater.kt index f762d93286..3191f5ebb8 100644 --- a/okio/src/nativeMain/kotlin/okio/Deflater.kt +++ b/okio/src/nativeMain/kotlin/okio/Deflater.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/DeflaterSink.kt b/okio/src/nativeMain/kotlin/okio/DeflaterSink.kt index 496854d264..e61a6c7248 100644 --- a/okio/src/nativeMain/kotlin/okio/DeflaterSink.kt +++ b/okio/src/nativeMain/kotlin/okio/DeflaterSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import platform.zlib.Z_FINISH diff --git a/okio/src/nativeMain/kotlin/okio/FileSink.kt b/okio/src/nativeMain/kotlin/okio/FileSink.kt index 4b5142678b..847432cb41 100644 --- a/okio/src/nativeMain/kotlin/okio/FileSink.kt +++ b/okio/src/nativeMain/kotlin/okio/FileSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/FileSource.kt b/okio/src/nativeMain/kotlin/okio/FileSource.kt index 6e9965f4f0..48ac65aa0c 100644 --- a/okio/src/nativeMain/kotlin/okio/FileSource.kt +++ b/okio/src/nativeMain/kotlin/okio/FileSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/FileSystem.kt b/okio/src/nativeMain/kotlin/okio/FileSystem.kt index 726821896d..800845308a 100644 --- a/okio/src/nativeMain/kotlin/okio/FileSystem.kt +++ b/okio/src/nativeMain/kotlin/okio/FileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.contracts.InvocationKind diff --git a/okio/src/nativeMain/kotlin/okio/Inflater.kt b/okio/src/nativeMain/kotlin/okio/Inflater.kt index 82e63ee868..ed5162348e 100644 --- a/okio/src/nativeMain/kotlin/okio/Inflater.kt +++ b/okio/src/nativeMain/kotlin/okio/Inflater.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/InflaterSource.kt b/okio/src/nativeMain/kotlin/okio/InflaterSource.kt index 04351b968d..1c36306eed 100644 --- a/okio/src/nativeMain/kotlin/okio/InflaterSource.kt +++ b/okio/src/nativeMain/kotlin/okio/InflaterSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual class InflaterSource internal actual constructor( diff --git a/okio/src/nativeMain/kotlin/okio/PosixFileSystem.kt b/okio/src/nativeMain/kotlin/okio/PosixFileSystem.kt index 8958d99bea..39608516a1 100644 --- a/okio/src/nativeMain/kotlin/okio/PosixFileSystem.kt +++ b/okio/src/nativeMain/kotlin/okio/PosixFileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/nativeMain/kotlin/okio/PosixVariant.kt b/okio/src/nativeMain/kotlin/okio/PosixVariant.kt index d2c4ee3ef1..63cc1be40e 100644 --- a/okio/src/nativeMain/kotlin/okio/PosixVariant.kt +++ b/okio/src/nativeMain/kotlin/okio/PosixVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal expect val PLATFORM_TEMPORARY_DIRECTORY: Path diff --git a/okio/src/nativeMain/kotlin/okio/SizetVariant.kt b/okio/src/nativeMain/kotlin/okio/SizetVariant.kt index 46f5bca40c..a199169fa7 100644 --- a/okio/src/nativeMain/kotlin/okio/SizetVariant.kt +++ b/okio/src/nativeMain/kotlin/okio/SizetVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.ByteVar diff --git a/okio/src/nonAppleMain/kotlin/okio/ByteString.kt b/okio/src/nonAppleMain/kotlin/okio/ByteString.kt index e1b8cc5168..f7211055bb 100644 --- a/okio/src/nonAppleMain/kotlin/okio/ByteString.kt +++ b/okio/src/nonAppleMain/kotlin/okio/ByteString.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +@file:MustUseReturnValue package okio import okio.internal.HashFunction diff --git a/okio/src/nonAppleMain/kotlin/okio/SegmentedByteString.kt b/okio/src/nonAppleMain/kotlin/okio/SegmentedByteString.kt index 485d834ec4..1b839331b9 100644 --- a/okio/src/nonAppleMain/kotlin/okio/SegmentedByteString.kt +++ b/okio/src/nonAppleMain/kotlin/okio/SegmentedByteString.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.HashFunction diff --git a/okio/src/nonJsMain/kotlin/okio/internal/ByteStringNonJs.kt b/okio/src/nonJsMain/kotlin/okio/internal/ByteStringNonJs.kt index 968def1920..4d916903fe 100644 --- a/okio/src/nonJsMain/kotlin/okio/internal/ByteStringNonJs.kt +++ b/okio/src/nonJsMain/kotlin/okio/internal/ByteStringNonJs.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:JvmName("-ByteStringNonJs") // A leading '-' hides this class from Java. +@file:MustUseReturnValue package okio.internal diff --git a/okio/src/nonJvmMain/kotlin/okio/Buffer.kt b/okio/src/nonJvmMain/kotlin/okio/Buffer.kt index 003933359a..dbbbddc69a 100644 --- a/okio/src/nonJvmMain/kotlin/okio/Buffer.kt +++ b/okio/src/nonJvmMain/kotlin/okio/Buffer.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.HashFunction @@ -76,8 +77,10 @@ actual class Buffer : BufferedSource, BufferedSink { actual override val buffer: Buffer get() = this + @IgnorableReturnValue actual override fun emitCompleteSegments(): Buffer = this // Nowhere to emit to! + @IgnorableReturnValue actual override fun emit(): Buffer = this // Nowhere to emit to! actual override fun exhausted(): Boolean = size == 0L @@ -90,12 +93,14 @@ actual class Buffer : BufferedSource, BufferedSink { actual override fun peek(): BufferedSource = PeekSource(this).buffer() + @IgnorableReturnValue actual fun copyTo( out: Buffer, offset: Long, byteCount: Long, ): Buffer = commonCopyTo(out, offset, byteCount) + @IgnorableReturnValue actual fun copyTo( out: Buffer, offset: Long, @@ -129,6 +134,7 @@ actual class Buffer : BufferedSource, BufferedSink { actual override fun readFully(sink: Buffer, byteCount: Long): Unit = commonReadFully(sink, byteCount) + @IgnorableReturnValue actual override fun readAll(sink: Sink): Long = commonReadAll(sink) actual override fun readUtf8(): String = readUtf8(size) @@ -162,51 +168,70 @@ actual class Buffer : BufferedSource, BufferedSink { actual override fun skip(byteCount: Long): Unit = commonSkip(byteCount) + @IgnorableReturnValue actual override fun write(byteString: ByteString): Buffer = commonWrite(byteString) + @IgnorableReturnValue actual override fun write(byteString: ByteString, offset: Int, byteCount: Int) = commonWrite(byteString, offset, byteCount) internal actual fun writableSegment(minimumCapacity: Int): Segment = commonWritableSegment(minimumCapacity) + @IgnorableReturnValue actual override fun writeUtf8(string: String): Buffer = writeUtf8(string, 0, string.length) + @IgnorableReturnValue actual override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer = commonWriteUtf8(string, beginIndex, endIndex) + @IgnorableReturnValue actual override fun writeUtf8CodePoint(codePoint: Int): Buffer = commonWriteUtf8CodePoint(codePoint) + @IgnorableReturnValue actual override fun write(source: ByteArray): Buffer = commonWrite(source) + @IgnorableReturnValue actual override fun write(source: ByteArray, offset: Int, byteCount: Int): Buffer = commonWrite(source, offset, byteCount) + @IgnorableReturnValue actual override fun writeAll(source: Source): Long = commonWriteAll(source) + @IgnorableReturnValue actual override fun write(source: Source, byteCount: Long): Buffer = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun writeByte(b: Int): Buffer = commonWriteByte(b) + @IgnorableReturnValue actual override fun writeShort(s: Int): Buffer = commonWriteShort(s) + @IgnorableReturnValue actual override fun writeShortLe(s: Int): Buffer = writeShort(s.toShort().reverseBytes().toInt()) + @IgnorableReturnValue actual override fun writeInt(i: Int): Buffer = commonWriteInt(i) + @IgnorableReturnValue actual override fun writeIntLe(i: Int): Buffer = writeInt(i.reverseBytes()) + @IgnorableReturnValue actual override fun writeLong(v: Long): Buffer = commonWriteLong(v) + @IgnorableReturnValue actual override fun writeLongLe(v: Long): Buffer = writeLong(v.reverseBytes()) + @IgnorableReturnValue actual override fun writeDecimalLong(v: Long): Buffer = commonWriteDecimalLong(v) + @IgnorableReturnValue actual override fun writeHexadecimalUnsignedLong(v: Long): Buffer = commonWriteHexadecimalUnsignedLong(v) + @IgnorableReturnValue actual override fun write(source: Buffer, byteCount: Long): Unit = commonWrite(source, byteCount) actual override fun read(sink: Buffer, byteCount: Long): Long = commonRead(sink, byteCount) @@ -298,8 +323,10 @@ actual class Buffer : BufferedSource, BufferedSink { } } + @IgnorableReturnValue actual fun readUnsafe(unsafeCursor: UnsafeCursor): UnsafeCursor = commonReadUnsafe(unsafeCursor) + @IgnorableReturnValue actual fun readAndWriteUnsafe(unsafeCursor: UnsafeCursor): UnsafeCursor = commonReadAndWriteUnsafe(unsafeCursor) @@ -313,12 +340,16 @@ actual class Buffer : BufferedSource, BufferedSink { actual var start = -1 actual var end = -1 + @IgnorableReturnValue actual fun next(): Int = commonNext() + @IgnorableReturnValue actual fun seek(offset: Long): Int = commonSeek(offset) + @IgnorableReturnValue actual fun resizeBuffer(newSize: Long): Long = commonResizeBuffer(newSize) + @IgnorableReturnValue actual fun expandBuffer(minByteCount: Int): Long = commonExpandBuffer(minByteCount) actual override fun close() { diff --git a/okio/src/nonJvmMain/kotlin/okio/BufferedSink.kt b/okio/src/nonJvmMain/kotlin/okio/BufferedSink.kt index cdb767a228..8c0a2ced99 100644 --- a/okio/src/nonJvmMain/kotlin/okio/BufferedSink.kt +++ b/okio/src/nonJvmMain/kotlin/okio/BufferedSink.kt @@ -13,48 +13,69 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual sealed interface BufferedSink : Sink { actual val buffer: Buffer + @IgnorableReturnValue actual fun write(byteString: ByteString): BufferedSink + @IgnorableReturnValue actual fun write(byteString: ByteString, offset: Int, byteCount: Int): BufferedSink + @IgnorableReturnValue actual fun write(source: ByteArray): BufferedSink + @IgnorableReturnValue actual fun write(source: ByteArray, offset: Int, byteCount: Int): BufferedSink + @IgnorableReturnValue actual fun writeAll(source: Source): Long + @IgnorableReturnValue actual fun write(source: Source, byteCount: Long): BufferedSink + @IgnorableReturnValue actual fun writeUtf8(string: String): BufferedSink + @IgnorableReturnValue actual fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): BufferedSink + @IgnorableReturnValue actual fun writeUtf8CodePoint(codePoint: Int): BufferedSink + @IgnorableReturnValue actual fun writeByte(b: Int): BufferedSink + @IgnorableReturnValue actual fun writeShort(s: Int): BufferedSink + @IgnorableReturnValue actual fun writeShortLe(s: Int): BufferedSink + @IgnorableReturnValue actual fun writeInt(i: Int): BufferedSink + @IgnorableReturnValue actual fun writeIntLe(i: Int): BufferedSink + @IgnorableReturnValue actual fun writeLong(v: Long): BufferedSink + @IgnorableReturnValue actual fun writeLongLe(v: Long): BufferedSink + @IgnorableReturnValue actual fun writeDecimalLong(v: Long): BufferedSink + @IgnorableReturnValue actual fun writeHexadecimalUnsignedLong(v: Long): BufferedSink + @IgnorableReturnValue actual fun emit(): BufferedSink + @IgnorableReturnValue actual fun emitCompleteSegments(): BufferedSink } diff --git a/okio/src/nonJvmMain/kotlin/okio/BufferedSource.kt b/okio/src/nonJvmMain/kotlin/okio/BufferedSource.kt index 236ed61f62..e04f6f0162 100644 --- a/okio/src/nonJvmMain/kotlin/okio/BufferedSource.kt +++ b/okio/src/nonJvmMain/kotlin/okio/BufferedSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual sealed interface BufferedSource : Source { @@ -64,6 +65,7 @@ actual sealed interface BufferedSource : Source { actual fun readFully(sink: Buffer, byteCount: Long) + @IgnorableReturnValue actual fun readAll(sink: Sink): Long actual fun readUtf8(): String diff --git a/okio/src/nonJvmMain/kotlin/okio/ForwardingSource.kt b/okio/src/nonJvmMain/kotlin/okio/ForwardingSource.kt index 1b75eba576..cde45a04d2 100644 --- a/okio/src/nonJvmMain/kotlin/okio/ForwardingSource.kt +++ b/okio/src/nonJvmMain/kotlin/okio/ForwardingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual abstract class ForwardingSource actual constructor( diff --git a/okio/src/nonJvmMain/kotlin/okio/HashingSink.kt b/okio/src/nonJvmMain/kotlin/okio/HashingSink.kt index 15e4b9aeaf..ded2a4c645 100644 --- a/okio/src/nonJvmMain/kotlin/okio/HashingSink.kt +++ b/okio/src/nonJvmMain/kotlin/okio/HashingSink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.HashFunction diff --git a/okio/src/nonJvmMain/kotlin/okio/HashingSource.kt b/okio/src/nonJvmMain/kotlin/okio/HashingSource.kt index dae96c6bb3..def1fceb34 100644 --- a/okio/src/nonJvmMain/kotlin/okio/HashingSource.kt +++ b/okio/src/nonJvmMain/kotlin/okio/HashingSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.HashFunction diff --git a/okio/src/nonJvmMain/kotlin/okio/NonJvmPlatform.kt b/okio/src/nonJvmMain/kotlin/okio/NonJvmPlatform.kt index ffe9253f4c..eb37132214 100644 --- a/okio/src/nonJvmMain/kotlin/okio/NonJvmPlatform.kt +++ b/okio/src/nonJvmMain/kotlin/okio/NonJvmPlatform.kt @@ -14,6 +14,7 @@ * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.contracts.InvocationKind diff --git a/okio/src/nonJvmMain/kotlin/okio/Path.kt b/okio/src/nonJvmMain/kotlin/okio/Path.kt index 16328afa78..e44ec6e7d1 100644 --- a/okio/src/nonJvmMain/kotlin/okio/Path.kt +++ b/okio/src/nonJvmMain/kotlin/okio/Path.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.commonCompareTo diff --git a/okio/src/nonJvmMain/kotlin/okio/RealBufferedSink.kt b/okio/src/nonJvmMain/kotlin/okio/RealBufferedSink.kt index f41cd6ebc0..4a9639904d 100644 --- a/okio/src/nonJvmMain/kotlin/okio/RealBufferedSink.kt +++ b/okio/src/nonJvmMain/kotlin/okio/RealBufferedSink.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +@file:MustUseReturnValue package okio import okio.internal.commonClose @@ -43,30 +43,50 @@ internal actual class RealBufferedSink actual constructor( actual override val buffer = Buffer() actual override fun write(source: Buffer, byteCount: Long) = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun write(byteString: ByteString) = commonWrite(byteString) + @IgnorableReturnValue actual override fun write(byteString: ByteString, offset: Int, byteCount: Int) = commonWrite(byteString, offset, byteCount) + @IgnorableReturnValue actual override fun writeUtf8(string: String) = commonWriteUtf8(string) + @IgnorableReturnValue actual override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int) = commonWriteUtf8(string, beginIndex, endIndex) + @IgnorableReturnValue actual override fun writeUtf8CodePoint(codePoint: Int) = commonWriteUtf8CodePoint(codePoint) + @IgnorableReturnValue actual override fun write(source: ByteArray) = commonWrite(source) + @IgnorableReturnValue actual override fun write(source: ByteArray, offset: Int, byteCount: Int) = commonWrite(source, offset, byteCount) + @IgnorableReturnValue actual override fun writeAll(source: Source) = commonWriteAll(source) + @IgnorableReturnValue actual override fun write(source: Source, byteCount: Long): BufferedSink = commonWrite(source, byteCount) + @IgnorableReturnValue actual override fun writeByte(b: Int) = commonWriteByte(b) + @IgnorableReturnValue actual override fun writeShort(s: Int) = commonWriteShort(s) + @IgnorableReturnValue actual override fun writeShortLe(s: Int) = commonWriteShortLe(s) + @IgnorableReturnValue actual override fun writeInt(i: Int) = commonWriteInt(i) + @IgnorableReturnValue actual override fun writeIntLe(i: Int) = commonWriteIntLe(i) + @IgnorableReturnValue actual override fun writeLong(v: Long) = commonWriteLong(v) + @IgnorableReturnValue actual override fun writeLongLe(v: Long) = commonWriteLongLe(v) + @IgnorableReturnValue actual override fun writeDecimalLong(v: Long) = commonWriteDecimalLong(v) + @IgnorableReturnValue actual override fun writeHexadecimalUnsignedLong(v: Long) = commonWriteHexadecimalUnsignedLong(v) + @IgnorableReturnValue actual override fun emitCompleteSegments() = commonEmitCompleteSegments() + @IgnorableReturnValue actual override fun emit() = commonEmit() actual override fun flush() = commonFlush() actual override fun close() = commonClose() diff --git a/okio/src/nonJvmMain/kotlin/okio/RealBufferedSource.kt b/okio/src/nonJvmMain/kotlin/okio/RealBufferedSource.kt index 6701e0a8b9..2193dcc2e1 100644 --- a/okio/src/nonJvmMain/kotlin/okio/RealBufferedSource.kt +++ b/okio/src/nonJvmMain/kotlin/okio/RealBufferedSource.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.internal.commonClose diff --git a/okio/src/nonJvmMain/kotlin/okio/SegmentPool.kt b/okio/src/nonJvmMain/kotlin/okio/SegmentPool.kt index 50e709913b..db041eb044 100644 --- a/okio/src/nonJvmMain/kotlin/okio/SegmentPool.kt +++ b/okio/src/nonJvmMain/kotlin/okio/SegmentPool.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal actual object SegmentPool { diff --git a/okio/src/nonJvmMain/kotlin/okio/Sink.kt b/okio/src/nonJvmMain/kotlin/okio/Sink.kt index d114647220..a13ac6a155 100644 --- a/okio/src/nonJvmMain/kotlin/okio/Sink.kt +++ b/okio/src/nonJvmMain/kotlin/okio/Sink.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual interface Sink : Closeable { diff --git a/okio/src/nonJvmMain/kotlin/okio/Timeout.kt b/okio/src/nonJvmMain/kotlin/okio/Timeout.kt index d66a0274e8..27366b2135 100644 --- a/okio/src/nonJvmMain/kotlin/okio/Timeout.kt +++ b/okio/src/nonJvmMain/kotlin/okio/Timeout.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio actual open class Timeout { diff --git a/okio/src/systemFileSystemMain/kotlin/okio/FileSystem.System.kt b/okio/src/systemFileSystemMain/kotlin/okio/FileSystem.System.kt index 0bc7e4dafb..2afa6d1e2b 100644 --- a/okio/src/systemFileSystemMain/kotlin/okio/FileSystem.System.kt +++ b/okio/src/systemFileSystemMain/kotlin/okio/FileSystem.System.kt @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@file:MustUseReturnValue package okio /* diff --git a/okio/src/unixMain/kotlin/okio/UnixFileHandle.kt b/okio/src/unixMain/kotlin/okio/UnixFileHandle.kt index 62e7849f7e..cb37cbd761 100644 --- a/okio/src/unixMain/kotlin/okio/UnixFileHandle.kt +++ b/okio/src/unixMain/kotlin/okio/UnixFileHandle.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.CPointer diff --git a/okio/src/unixMain/kotlin/okio/UnixPosixVariant.kt b/okio/src/unixMain/kotlin/okio/UnixPosixVariant.kt index 27630d6775..cae98ca7f7 100644 --- a/okio/src/unixMain/kotlin/okio/UnixPosixVariant.kt +++ b/okio/src/unixMain/kotlin/okio/UnixPosixVariant.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlinx.cinterop.ByteVar diff --git a/okio/src/wasmMain/kotlin/okio/FileSystem.kt b/okio/src/wasmMain/kotlin/okio/FileSystem.kt index e88a63d73f..b9cb506a46 100644 --- a/okio/src/wasmMain/kotlin/okio/FileSystem.kt +++ b/okio/src/wasmMain/kotlin/okio/FileSystem.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import kotlin.contracts.ExperimentalContracts diff --git a/okio/src/wasmMain/kotlin/okio/WasmPlatform.kt b/okio/src/wasmMain/kotlin/okio/WasmPlatform.kt index 4a874ec826..61d8339398 100644 --- a/okio/src/wasmMain/kotlin/okio/WasmPlatform.kt +++ b/okio/src/wasmMain/kotlin/okio/WasmPlatform.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio internal actual val PLATFORM_DIRECTORY_SEPARATOR: String diff --git a/okio/src/zlibMain/kotlin/okio/Deflater.kt b/okio/src/zlibMain/kotlin/okio/Deflater.kt index e561f04146..8be4685d7a 100644 --- a/okio/src/zlibMain/kotlin/okio/Deflater.kt +++ b/okio/src/zlibMain/kotlin/okio/Deflater.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/zlibMain/kotlin/okio/DeflaterSink.kt b/okio/src/zlibMain/kotlin/okio/DeflaterSink.kt index b81e7dd00f..215ffa2235 100644 --- a/okio/src/zlibMain/kotlin/okio/DeflaterSink.kt +++ b/okio/src/zlibMain/kotlin/okio/DeflaterSink.kt @@ -15,6 +15,7 @@ */ @file:JvmName("-DeflaterSinkExtensions") +@file:MustUseReturnValue package okio diff --git a/okio/src/zlibMain/kotlin/okio/GzipSink.kt b/okio/src/zlibMain/kotlin/okio/GzipSink.kt index fa3cf162ee..4d744f4123 100644 --- a/okio/src/zlibMain/kotlin/okio/GzipSink.kt +++ b/okio/src/zlibMain/kotlin/okio/GzipSink.kt @@ -15,6 +15,7 @@ */ @file:JvmName("-GzipSinkExtensions") +@file:MustUseReturnValue @file:Suppress("NOTHING_TO_INLINE") // Aliases to public API. package okio diff --git a/okio/src/zlibMain/kotlin/okio/GzipSource.kt b/okio/src/zlibMain/kotlin/okio/GzipSource.kt index 27b65d407b..8c496bb27c 100644 --- a/okio/src/zlibMain/kotlin/okio/GzipSource.kt +++ b/okio/src/zlibMain/kotlin/okio/GzipSource.kt @@ -15,6 +15,7 @@ */ @file:JvmName("-GzipSourceExtensions") +@file:MustUseReturnValue @file:Suppress("NOTHING_TO_INLINE") // Aliases to public API. package okio diff --git a/okio/src/zlibMain/kotlin/okio/Inflater.kt b/okio/src/zlibMain/kotlin/okio/Inflater.kt index 600804a7d9..8d7a59d953 100644 --- a/okio/src/zlibMain/kotlin/okio/Inflater.kt +++ b/okio/src/zlibMain/kotlin/okio/Inflater.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio /** diff --git a/okio/src/zlibMain/kotlin/okio/InflaterSource.kt b/okio/src/zlibMain/kotlin/okio/InflaterSource.kt index 01bfc8efa9..1c23255a32 100644 --- a/okio/src/zlibMain/kotlin/okio/InflaterSource.kt +++ b/okio/src/zlibMain/kotlin/okio/InflaterSource.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:JvmName("-InflaterSourceExtensions") +@file:MustUseReturnValue package okio diff --git a/okio/src/zlibMain/kotlin/okio/ZipFileSystem.kt b/okio/src/zlibMain/kotlin/okio/ZipFileSystem.kt index 88972fb2b6..f2b52ceaba 100644 --- a/okio/src/zlibMain/kotlin/okio/ZipFileSystem.kt +++ b/okio/src/zlibMain/kotlin/okio/ZipFileSystem.kt @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:MustUseReturnValue package okio import okio.Path.Companion.toPath diff --git a/okio/src/zlibMain/kotlin/okio/ZlibOkio.kt b/okio/src/zlibMain/kotlin/okio/ZlibOkio.kt index 827e001d52..8f656d819a 100644 --- a/okio/src/zlibMain/kotlin/okio/ZlibOkio.kt +++ b/okio/src/zlibMain/kotlin/okio/ZlibOkio.kt @@ -16,6 +16,7 @@ @file:JvmMultifileClass @file:JvmName("Okio") +@file:MustUseReturnValue package okio