From 40bf0870f788c142f0eb1c2bfbda540ae4a93a08 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Sat, 7 Feb 2026 03:18:11 +0000 Subject: [PATCH] 8377392: jpackage: Fix member function called from the CfgFile.Referencies compact canonical constructor Reviewed-by: liach, almatvee --- .../share/classes/jdk/jpackage/internal/CfgFile.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java index 9cb9fb5cba0..7958dcdef2d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,21 +124,19 @@ final class CfgFile { Files.write(cfgFile, (Iterable) lines::iterator); } - private record Referencies(Path appModsDirectory) { + private record Referencies(Path appModsDirectory, Path appDirectory) { Referencies { - if (!appModsDirectory.startsWith(appDirectory())) { + if (!appModsDirectory.startsWith(appDirectory)) { throw new IllegalArgumentException(); } } Referencies(ApplicationLayout appLayout) { - this(Path.of("$APPDIR").resolve(appLayout.appModsDirectory().getFileName())); + this(BASEDIR.resolve(appLayout.appModsDirectory().getFileName()), BASEDIR); } - Path appDirectory() { - return Path.of("$APPDIR"); - } + private static final Path BASEDIR = Path.of("$APPDIR"); } private final LauncherStartupInfo startupInfo;