RFR: 8356047: [macos] jpackage produces confusing post- and pre- installation PKG scripts [v3]
Alexander Matveev
almatvee at openjdk.org
Sat Sep 27 02:23:18 UTC 2025
On Fri, 26 Sep 2025 20:19:31 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:
>> src/jdk.jpackage/unix/classes/jdk/jpackage/internal/PackageScripts.java line 81:
>>
>>> 79: static class ResourceConfig {
>>> 80:
>>> 81: ResourceConfig(String defaultName, String categoryId, boolean noDefault) {
>>
>> Don't you think `String defaultName, String categoryId, boolean noDefault` signature looks odd? You have a parameter specifying the default name and another parameter that specifies if the default name is set or not.
>>
>> Wouldn't:
>>
>> ResourceConfig(Optional<String> defaultName, String categoryId)
>>
>> be less confusing?
>>
>> For backward compatibility keep the old ctor, but redefine it:
>>
>> ResourceConfig(String defaultName, String categoryId) {
>> this(Optional.of(defaultName), categoryId);
>> }
>
> In your suggested case how `ResourceConfig.getDefaultPublicName()` will figure out public name for resource if `defaultName` is not provided? Maybe `String resourceName, String categoryId, boolean noDefault` will be less confusing?
I will add `ResourceConfig(Optional<String> defaultName, Optional<String> publicName, String categoryId)` instead of suggested.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25510#discussion_r2383774258
More information about the core-libs-dev
mailing list