From 3191e4e79f2e9a80fb69674604ffdb2032fe5bff Mon Sep 17 00:00:00 2001 From: James Roome Date: Wed, 19 Aug 2026 15:38:44 +0530 Subject: [PATCH] docs: fix the README sample, and refresh version examples before they ship Two unrelated doc defects, both found by a pre-tag audit, both worth fixing before 0.0.7 is published rather than after. README's first Java sample did not compile. It opens with `import io.github.refux.slang.*;`, and java.lang.Module is implicitly on-demand imported too, so `Module module = ...` is ambiguous: error: reference to Module is ambiguous both class io.github.refux.slang.Module in io.github.refux.slang and class java.lang.Module in java.lang match Not a regression from the Slang bump -- it has been wrong since the consumer-facing README was written -- but it is the first code anyone runs. Verified by extracting the block from README.md and compiling it against the real 0.0.7 jar, with and without the added import: the error above without, clean with. The javadoc examples matter for a narrower reason: they ship inside slang-java-0.0.7- javadoc.jar to Maven Central, which cannot be replaced once released, so a stale example is permanently stale for this version. GlobalSession#buildTagString and SlangNative#spGetBuildTagString both illustrated "2026.13"; they now say "2026.14.1", which also stops the example under-representing the real tag, now three components rather than two. SlangLibrary's versioned-filename fallback illustrated libslang-compiler.0.2026.13.dylib; it now names 0.2026.14.1, taken from natives/manifests/macos-aarch64.json rather than invented. ModuleInfo's `e.g. "2026.8"` is deliberately left alone. That field is the build tag of the release that WROTE the IR, and an older writer than the running compiler is exactly the case the surrounding javadoc is describing -- an example naming the current release would illustrate the wrong thing. Co-Authored-By: Claude Opus 5 --- README.md | 1 + slang/src/main/java/io/github/refux/slang/GlobalSession.java | 2 +- slang/src/main/java/io/github/refux/slang/ffi/SlangNative.java | 2 +- .../main/java/io/github/refux/slang/loader/SlangLibrary.java | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2dc4334..e791573 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Then compile a shader and reflect on it: ```java import io.github.refux.slang.*; +import io.github.refux.slang.Module; // disambiguates from java.lang.Module try (GlobalSession global = Slang.createGlobalSession(); Session session = global.newSession() diff --git a/slang/src/main/java/io/github/refux/slang/GlobalSession.java b/slang/src/main/java/io/github/refux/slang/GlobalSession.java index 6e9e180..2cf0093 100644 --- a/slang/src/main/java/io/github/refux/slang/GlobalSession.java +++ b/slang/src/main/java/io/github/refux/slang/GlobalSession.java @@ -46,7 +46,7 @@ public int findProfile(String name) { return ffi().findProfile(name); } - /** The Slang build tag of the loaded native library, e.g. {@code "2026.13"}. */ + /** The Slang build tag of the loaded native library, e.g. {@code "2026.14.1"}. */ public String buildTagString() { return ffi().getBuildTagString(); } diff --git a/slang/src/main/java/io/github/refux/slang/ffi/SlangNative.java b/slang/src/main/java/io/github/refux/slang/ffi/SlangNative.java index 07c60d6..3cc1358 100644 --- a/slang/src/main/java/io/github/refux/slang/ffi/SlangNative.java +++ b/slang/src/main/java/io/github/refux/slang/ffi/SlangNative.java @@ -11,7 +11,7 @@ public final class SlangNative { private SlangNative() {} - /** Returns the build tag of the loaded Slang library, e.g. {@code "2026.13"}. */ + /** Returns the build tag of the loaded Slang library, e.g. {@code "2026.14.1"}. */ public static String spGetBuildTagString() { return readUtf8(SlangAPI.spGetBuildTagString()); } diff --git a/slang/src/main/java/io/github/refux/slang/loader/SlangLibrary.java b/slang/src/main/java/io/github/refux/slang/loader/SlangLibrary.java index 4143dd4..7e75a86 100644 --- a/slang/src/main/java/io/github/refux/slang/loader/SlangLibrary.java +++ b/slang/src/main/java/io/github/refux/slang/loader/SlangLibrary.java @@ -240,7 +240,7 @@ private static String currentArch() { * Picks the Slang compiler library file inside {@code dir}. Tries the exact platform names * first ({@code libslang-compiler.dylib}, {@code slang-compiler.dll}, …, then the legacy * {@code slang} names), and falls back to version-suffixed files such as - * {@code libslang-compiler.0.2026.13.dylib} — official archives may not preserve the + * {@code libslang-compiler.0.2026.14.1.dylib} — official archives may not preserve the * unversioned symlink. The prefix match is written so companion libraries * ({@code libslang-glslang}, {@code libslang-rt}, …) can never be picked up by mistake. */