On Sat, 25 Oct 2025 04:23:23 GMT, Alexander Matveev <[email protected]> 
wrote:

>> Alexey Semenyuk has refreshed the contents of this pull request, and 
>> previous commits have been removed. The incremental views will show 
>> differences compared to the previous content of the PR. The pull request 
>> contains eight new commits since the last revision:
>> 
>>  - DefaultLauncherIcon: blessed-modifier-order.sh  fix
>>  - FileAssociations: revert redundant change
>>  - Fix fa icon verification on Linux
>>  - LinuxPackagingPipeline, WinPackagingPipeline: remove unused 
>> normalizeShortcuts() methods
>>  - IconTest: revamp
>>  - LinuxHelper: revamp
>>  - Don't add the default launcher icon to app image on Linux
>>  - Make Launcher interface provide complete information about the source of 
>> the launcher icon; Before this change, the function getting a resource for 
>> an additional launcher icon took both the additional launcher and the main 
>> launcher as input. Now its result doesn't depend on the main launcher.
>
> src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationBuilder.java 
> line 175:
> 
>> 173:     }
>> 174: 
>> 175:     static <T extends Launcher> ApplicationLaunchers normalizeIcons(
> 
> Can you explain why we need this code?

Previously, 
[ApplicationImageUtils.createLauncherIconResource()](https://github.com/openjdk/jdk/blob/32697bf652429fa7247047465e365835dfa24b39/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationImageUtils.java#L53)
 function required the `Application` instance to get the icon of a launcher 
because for additional launchers getting icon was a function taking the main 
launcher into account.

`normalizeIcons()` modifies application launchers so that they contain complete 
information about their icons.
The follow-up for this change, 
`ApplicationImageUtils.createLauncherIconResource()`, is modified to no longer 
require an `Application` instance.

There are other properties in additional launchers that depend on the main 
launcher: description, shortcuts. Each is calculated in a unique way. 

Descripton: 
https://github.com/openjdk/jdk/blob/32697bf652429fa7247047465e365835dfa24b39/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromParams.java#L232

Shortcuts:
https://github.com/openjdk/jdk/blob/32697bf652429fa7247047465e365835dfa24b39/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromParams.java#L176

So we have three functions doing the same thing: they calculate the value of a 
property of an additionl launcher from the value in the property file of the 
additional launcher and the value of this property of the main launcher. The 
logic is the same in all these functions: if an additional launcher doesn't 
explicitly set the value of a property, it should be copied from the main 
launcher.

I moved this logic to a single function - 
`ApplicationBuilder.normalizeLauncherProperty()`. Currently, it is used for 
launcher icons only, but later will be used for other launcher poroperties.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27928#discussion_r2462907768

Reply via email to