From e7b724c6ba5cc17a001d68a42c110c3010cf3444 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Fri, 26 Jun 2026 20:51:26 +0200 Subject: [PATCH] refactor: make NativeCall.requireNative return void Every caller uses it as a guard statement and discards the returned segment, so the fluent return was dead. Drop it. Co-Authored-By: Claude Opus 4.8 --- zstd/src/main/java/io/github/dfa1/zstd/NativeCall.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zstd/src/main/java/io/github/dfa1/zstd/NativeCall.java b/zstd/src/main/java/io/github/dfa1/zstd/NativeCall.java index 71181b8..463e0a9 100644 --- a/zstd/src/main/java/io/github/dfa1/zstd/NativeCall.java +++ b/zstd/src/main/java/io/github/dfa1/zstd/NativeCall.java @@ -59,12 +59,11 @@ private static String errorName(long code) { /// Guards a zero-copy entry point: the segment handed to zstd must be backed /// by native (off-heap) memory, since its address is dereferenced in C. Fails /// fast with a clear message instead of the FFM linker's cryptic error. - static MemorySegment requireNative(MemorySegment seg, String name) { + static void requireNative(MemorySegment seg, String name) { if (!seg.isNative()) { throw new IllegalArgumentException( name + " must be a native (off-heap) MemorySegment; got a heap segment"); } - return seg; } /// Rethrows any `Throwable` as if unchecked, laundering the checked