RFR: 8347831: Re-examine version check when cross linking [v7]
Severin Gehwolf
sgehwolf at openjdk.org
Fri Nov 14 10:18:19 UTC 2025
On Thu, 13 Nov 2025 19:59:47 GMT, Henry Jen <henryjen at openjdk.org> wrote:
>> This PR include build changes from @magicus and jlink change to verify the build signature.
>>
>> Tested with local builds for MacOS and Linux as below shows that cross linking with same build is working while linking with different build failed with error message.
>>
>> ❯ export JAVA_HOME=./build/macosx-x86_64-server-fastdebug/images/jdk-bundle/jdk-26.jdk/Contents/Home
>>
>> ❯ java --version
>> openjdk 26-internal 2026-03-17
>> OpenJDK Runtime Environment (fastdebug build 26-internal-adhoc.hjen.JDK-8347831)
>> OpenJDK 64-Bit Server VM (fastdebug build 26-internal-adhoc.hjen.JDK-8347831, mixed mode, sharing)
>>
>> ❯ jlink --version
>> 26-internal
>>
>> ❯ jlink --module-path ./build/linux-x86_64-server-release/images/jdk/jmods --add-modules java.base --output linux
>>
>> ❯ jlink --add-modules java.base --output macos
>>
>> ❯ jlink --module-path ~/linux/jdk-25.0.1/jmods --add-modules java.base --output linux25
>> Error: jlink build N/A-26-internal-adhoc.hjen.JDK-8347831-2026-03-17 does not match target java.base build N/A
>>
>> ❯ jlink --module-path /Library/Java/JavaVirtualMachines/jdk-25.jdk/Contents/Home/jmods --add-modules java.base --output macos25
>> Error: jlink build N/A-26-internal-adhoc.hjen.JDK-8347831-2026-03-17 does not match target java.base build N/A
>
> Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
>
> remove the extra space
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java line 604:
> 602: *
> 603: * @throws IllegalArgumentException This jlink cannot be used to create
> 604: * the target runtime image.
Suggestion:
* @throws IllegalArgumentException If the `java.base` module reference `target` is not compatible with this jlink.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java line 615:
> 613: }
> 614:
> 615: var targetRelease = releaseInfo.get();
This can be simplified:
String targetRelease = getReleaseInfo(target).orElseThrow(() -> new IllegalArgumentException(taskHelper...));
src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties line 133:
> 131: err.empty.module.path=No module found in module path ''{0}'' with --add-modules ALL-MODULE-PATH
> 132: err.limit.modules=--limit-modules not allowed with --add-modules ALL-MODULE-PATH
> 133: err.jlink.version.mismatch=jlink build {0} does not match target java.base build {1}
It would be good if the build info in the error is quoted. It's otherwise hard to discern where the build info starts/ends in the message:
Suggestion:
err.jlink.version.mismatch=jlink build ''{0}'' does not match target java.base build ''{1}''
src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties line 134:
> 132: err.limit.modules=--limit-modules not allowed with --add-modules ALL-MODULE-PATH
> 133: err.jlink.version.mismatch=jlink build {0} does not match target java.base build {1}
> 134: err.jlink.version.missing=jlink build {0} cannot find the build signature\
Suggestion:
err.jlink.version.missing=jlink build ''{0}'' cannot find the build signature\
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28155#discussion_r2526889972
PR Review Comment: https://git.openjdk.org/jdk/pull/28155#discussion_r2526868718
PR Review Comment: https://git.openjdk.org/jdk/pull/28155#discussion_r2526873977
PR Review Comment: https://git.openjdk.org/jdk/pull/28155#discussion_r2526875224
More information about the core-libs-dev
mailing list