From b8110ecdf3a020ea6e0440579d7a04d1c5df18a1 Mon Sep 17 00:00:00 2001 From: John <1615532+johnoliver@users.noreply.github.com> Date: Fri, 12 Jun 2026 12:07:36 +0000 Subject: [PATCH] Fixes from review --- dist/setup/index.js | 9 ++++----- src/distributions/adopt/installer.ts | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 18c4633e..1ec38992 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -77825,16 +77825,15 @@ class AdoptDistribution extends base_installer_1.JavaBase { constructor(installerOptions, jvmImpl, temurinDistribution = null) { super(`Adopt-${jvmImpl}`, installerOptions); this.jvmImpl = jvmImpl; - this.temurinDistribution = temurinDistribution; if (temurinDistribution !== null && jvmImpl !== AdoptImplementation.Hotspot) { throw new Error('Only Hotspot JVM is supported by Temurin.'); } // Only use the temurin repo for Hotspot JVMs - if (temurinDistribution === null && - jvmImpl === AdoptImplementation.Hotspot) { - this.temurinDistribution = new installer_1.TemurinDistribution(installerOptions, installer_1.TemurinImplementation.Hotspot); - } + this.temurinDistribution = + temurinDistribution !== null && temurinDistribution !== void 0 ? temurinDistribution : (jvmImpl === AdoptImplementation.Hotspot + ? new installer_1.TemurinDistribution(installerOptions, installer_1.TemurinImplementation.Hotspot) + : null); } findPackageForDownload(version) { return __awaiter(this, void 0, void 0, function* () { diff --git a/src/distributions/adopt/installer.ts b/src/distributions/adopt/installer.ts index edfc0f3b..00a1a6b3 100644 --- a/src/distributions/adopt/installer.ts +++ b/src/distributions/adopt/installer.ts @@ -29,10 +29,12 @@ export enum AdoptImplementation { } export class AdoptDistribution extends JavaBase { + private readonly temurinDistribution: TemurinDistribution | null; + constructor( installerOptions: JavaInstallerOptions, private readonly jvmImpl: AdoptImplementation, - private readonly temurinDistribution: TemurinDistribution | null = null + temurinDistribution: TemurinDistribution | null = null ) { super(`Adopt-${jvmImpl}`, installerOptions); @@ -44,15 +46,14 @@ export class AdoptDistribution extends JavaBase { } // Only use the temurin repo for Hotspot JVMs - if ( - temurinDistribution === null && - jvmImpl === AdoptImplementation.Hotspot - ) { - this.temurinDistribution = new TemurinDistribution( - installerOptions, - TemurinImplementation.Hotspot - ); - } + this.temurinDistribution = + temurinDistribution ?? + (jvmImpl === AdoptImplementation.Hotspot + ? new TemurinDistribution( + installerOptions, + TemurinImplementation.Hotspot + ) + : null); } protected async findPackageForDownload(