diff --git a/qodana.yaml b/qodana.yaml index c32ef54..c22a5cc 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -12,6 +12,12 @@ linter: jetbrains/qodana-jvm-community:2026.1 profile: name: qodana.recommended +# Warnings are errors: any finding fails the run (and so the check). On PRs and pushes the action +# analyses only the changed files, so this gates new findings; a dispatched run scans everything. +failureConditions: + severityThresholds: + any: 0 + # Generated code is emitted clean and is not hand-maintained; exclude it from findings. exclude: - name: All diff --git a/slang/src/main/java/io/github/refux/slang/ffi/IGlobalSession.java b/slang/src/main/java/io/github/refux/slang/ffi/IGlobalSession.java index 69fd5a5..7078219 100644 --- a/slang/src/main/java/io/github/refux/slang/ffi/IGlobalSession.java +++ b/slang/src/main/java/io/github/refux/slang/ffi/IGlobalSession.java @@ -38,16 +38,16 @@ public static IGlobalSession create() { } /** - * The payload directory as a native string, allocated once per process, or {@link - * MemorySegment#NULL} when the library came from the platform's search path. Held globally - * because Slang's lifetime contract for the string handed to {@code setDownstreamCompilerPath} - * is not documented, so it must outlive the call. + * The payload directory as a native string, allocated once per process, or {@code null} when + * the library came from the platform's search path. Held globally because Slang's lifetime + * contract for the string handed to {@code setDownstreamCompilerPath} is not documented, so it + * must outlive the call. */ private static final class DownstreamPath { static final MemorySegment SEGMENT = SlangLibrary.get() .directory() .map(dir -> Arena.global().allocateFrom(dir.toString())) - .orElse(MemorySegment.NULL); + .orElse(null); } /** @@ -65,7 +65,8 @@ private static final class DownstreamPath { * the same pinning {@link SlangLibrary}'s class-path case already promises. */ private void pinDownstreamCompilersToPayload() { - if (DownstreamPath.SEGMENT.equals(MemorySegment.NULL)) { + MemorySegment payloadDir = DownstreamPath.SEGMENT; + if (payloadDir == null) { return; // Loaded off the platform search path; the host's own search order applies. } for (int passThrough : new int[] { @@ -73,8 +74,7 @@ private void pinDownstreamCompilersToPayload() { SlangPassThrough.SLANG_PASS_THROUGH_SPIRV_DIS, SlangPassThrough.SLANG_PASS_THROUGH_SPIRV_OPT }) { - io.github.refux.slang.ffi.gen.IGlobalSession.setDownstreamCompilerPath( - segment(), passThrough, DownstreamPath.SEGMENT); + io.github.refux.slang.ffi.gen.IGlobalSession.setDownstreamCompilerPath(segment(), passThrough, payloadDir); } }