RFR: 8342035: jlink plugins for setting java.vendor, java.vm.vendor and java.vendor.url [v4]

Mandy Chung mchung at openjdk.org
Wed Dec 4 19:04:42 UTC 2024


On Wed, 4 Dec 2024 07:31:24 GMT, Henry Jen <henryjen at openjdk.org> wrote:

>> Add jlink plugins to allow branding change for java.vendor, java.vm.vendor and java.vendor.url.
>> 
>> The jlink plugin will change the value in java.lang.VersionProps, which will set those property values. The `java.vm.vendor` was initialized by VM with value set at build time, and then later be replaced with value from VersionProps.
>> 
>> To keep current behavior, we treat 'N/A' value as no-op to mimic current build behavior. Perhaps we don't really need this, as proper value should be set with `branding.conf` in official build.
>
> Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Clean up adapting review comments

src/hotspot/share/runtime/abstract_vm_version.cpp line 132:

> 130: 
> 131: static const char vm_vendor_string[sizeof(VENDOR) < VENDOR_PADDING ? VENDOR_PADDING : sizeof(VENDOR)] = VENDOR;
> 132: const char* Abstract_VM_Version::_vm_vendor = vm_vendor_string;

As the system property is no longer set by VM, it can be initialized to null and this field should only be read after initPhase1.  The implementation would be much simplified.

src/java.base/share/classes/java/lang/VersionProps.java.template line 99:

> 97:     private static String VENDOR_VM =
> 98:         "@@VENDOR@@";
> 99: 

suggest to move after `VENDOR`.

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/VendorVMPlugin.java line 30:

> 28: /**
> 29:  * Plugin to set the vendor, by redefining the static field
> 30:  * java.lang.VersionProps.VENDOR

Suggestion:

 * Plugin to set the vendor for the VM, by redefining the static field
 * java.lang.VersionProps.VENDOR_VM

src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties line 226:

> 224: vendor-url.description=\
> 225: Override the vendor bug URL baked into the build.  The value\n\
> 226: of the system property "java.vendor.url" will be <vendor-url>.

Suggestion:

Override the vendor URL baked into the build.  The value\n\
of the system property "java.vendor.url" will be <vendor-url>.

src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties line 226:

> 224: vendor-url.description=\
> 225: Override the vendor bug URL baked into the build.  The value\n\
> 226: of the system property "java.vendor.url" will be <vendor-url>.

Suggestion:

Override the vendor URL baked into the build.  The value\n\
of the system property "java.vendor.url" will be <vendor-url>.

src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties line 230:

> 228: vendor-url.usage=\
> 229: \  --vendor-url <vendor-url>\n\
> 230: \                            Override the vendor bug URL baked into the build.\n\

Suggestion:

\                            Override the vendor URL baked into the build.\n\

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870107669
PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870109361
PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870110428
PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870121641
PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870123384
PR Review Comment: https://git.openjdk.org/jdk/pull/21964#discussion_r1870123680


More information about the core-libs-dev mailing list