On Wed, 24 Sep 2025 23:17:02 GMT, Alexander Matveev <[email protected]> 
wrote:

>> Introduce `jdk.jpackage.internal.SystemEnvironment` interface to describe 
>> system tools needed for building specific package bundles with three 
>> immediate subinterfaces: `WinSystemEnvironment`, `LinuxSystemEnvironment`, 
>> and `MacDmgSystemEnvironment`.
>> 
>> `LinuxSystemEnvironment` has two subinterfaces: `LinuxDebSystemEnvironment` 
>> and `LinuxRpmSystemEnvironment`.
>> 
>> There is no `MacSystemEnvironment` interface as pkg and dmg bundlers are 
>> unrelated, unlike rpm and deb bundlers, which share a fair amount of code.
>> 
>> There is no `MacPkgSystemEnvironment` interface because the pkg bundler 
>> doesn't validate tools.
>> 
>> Instances of these interfaces are created as member fields of the 
>> corresponding bundler classes, i.e., bundling system tools are validated 
>> only once when a specific bundler is instantiated.
>> 
>> Move the bundling code away from *Bundler classes into *Packager classes and 
>> completely isolate it from the "params". This is a follow-up for the effort 
>> to isolate the "params" in 
>> [JDK-8333664](https://bugs.openjdk.org/browse/JDK-8333664).
>
> src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebPackager.java 
> line 82:
> 
>> 80:             } catch (IOException ex) {
>> 81:                 // Try the default path if differ
>> 82:                 if (!realPath.toString().equals(file.toString())) {
> 
> Why converting to `String`? `realPath` and `file` are both `Path`. `Path` has 
> `equals` method.

This code is copied from 
[LinuxDebBundler.java#L108](https://github.com/openjdk/jdk/blame/569e78080b3c25c95d85e9e194626f95f86b9b10/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java#L108).

`Path.equals()` will always return `true` as two Path objects reference the 
same file. The test must compare path strings, not that two Path objects 
reference the same file (which they do). That is why `String.equals()` is used.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27377#discussion_r2379601925

Reply via email to