Using the capabilities added by JDK-8232080, consider my_image produced by jlink as follows:
> export ALL_MODULES=$(java --list-modules | sed 's:@.*::g' | tr '\n' ',')
> jlink --keep-packaged-modules=my_image/jmods --add-modules $ALL_MODULES --output my_image --vendor-version='XyzzyVM 3.14.15' --vendor-bug-url=https://bugs.xyzzy.com/ --add-options='-Dfoo=xyzzy'
> my_image/bin/java -XshowSettings:properties --version 2>&1 | grep -i xyzzy
foo = xyzzy
java.vendor.url.bug = https://bugs.xyzzy.com/
java.vendor.version = XyzzyVM 3.14.15
Java(TM) SE Runtime Environment XyzzyVM 3.14.15 (build 11.0.5.0.50+1-LTS)
Java HotSpot(TM) 64-Bit Server VM XyzzyVM 3.14.15 (build 11.0.5.0.50+1-LTS, mixed mode)
I would expect that when producing my_image2 from my_image, the custom vendor and option overrides would be preserved without having to specify them again to jlink. However, this appears not to be the case:
> my_image/bin/jlink --keep-packaged-modules=my_image2/jmods --add-modules $ALL_MODULES --output my_image2
> my_image2/bin/java -XshowSettings:properties --version 2>&1 | grep -i xyzzy
>
As a concrete example, for GraalVM this means anyone jlink'ing an image from GraalVM that includes jdk.internal.vm.compiler will be surprised when Graal is not used as the default JIT in the created image. Until this issue is resolved, the following flags need to be explicitly added to the jlink command line:
--add-options='-XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions' \
--add-modules 'java.base,jdk.internal.vm.ci,jdk.internal.vm.compiler'
One complication here is the relationship between command line options (e.g. EnableJVMCI and UseJVMCICompiler) and internal modules (jdk.internal.vm.ci and jdk.internal.vm.compiiler). That is, making changed values for EnableJVMCI and UseJVMCICompiler sticky requires making inclusion of jdk.internal.vm.ci and jdk.internal.vm.compiiler sticky.