Skip to content

Commit e77f8d3

Browse files
Fix ErrorTest --app-version tests failed on Windows
1 parent 03962e3 commit e77f8d3

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiPackageBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ WinMsiPackage create() throws ConfigException {
6464
}
6565

6666
return WinMsiPackage.create(pkg, new WinMsiPackageMixin.Stub(
67+
MsiVersion.of(pkg.version()),
6768
withInstallDirChooser,
6869
withShortcutPrompt,
6970
Optional.ofNullable(helpURL),

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplication.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@
2626

2727
import jdk.jpackage.internal.util.CompositeProxy;
2828

29-
public interface WinApplication extends Application {
30-
31-
default DottedVersion winVersion() {
32-
return DottedVersion.lazy(version());
33-
}
29+
public interface WinApplication extends Application, WinApplicationMixin {
3430

3531
public static WinApplication create(Application app) {
36-
return CompositeProxy.create(WinApplication.class, app);
32+
return CompositeProxy.create(WinApplication.class, app, new WinApplicationMixin.Stub(app));
3733
}
3834
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package jdk.jpackage.internal.model;
26+
27+
public interface WinApplicationMixin {
28+
29+
DottedVersion winVersion();
30+
31+
record Stub(DottedVersion winVersion) implements WinApplicationMixin {
32+
public Stub(Application app) {
33+
this(DottedVersion.greedy(app.version()));
34+
}
35+
}
36+
}

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinMsiPackage.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828

2929
public interface WinMsiPackage extends Package, WinMsiPackageMixin {
3030

31-
default DottedVersion msiVersion() {
32-
return MsiVersion.of(version());
33-
}
34-
3531
public static WinMsiPackage create(Package pkg, WinMsiPackageMixin mixin) {
3632
return CompositeProxy.create(WinMsiPackage.class, pkg, mixin);
3733
}

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinMsiPackageMixin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
public interface WinMsiPackageMixin {
3232

33+
DottedVersion msiVersion();
34+
3335
boolean withInstallDirChooser();
3436

3537
boolean withShortcutPrompt();
@@ -48,7 +50,7 @@ public interface WinMsiPackageMixin {
4850

4951
Optional<Path> serviceInstaller();
5052

51-
record Stub(boolean withInstallDirChooser, boolean withShortcutPrompt,
53+
record Stub(DottedVersion msiVersion, boolean withInstallDirChooser, boolean withShortcutPrompt,
5254
Optional<String> helpURL, Optional<String> updateURL, String startMenuGroupName,
5355
boolean isSystemWideInstall, UUID upgradeCode, UUID productCode,
5456
Optional<Path> serviceInstaller) implements WinMsiPackageMixin {}

0 commit comments

Comments
 (0)