From 41d73907d9cf4b08c7483a6a07d5ad4efaf13f84 Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Tue, 12 May 2020 13:52:39 +0200 Subject: SONAR-14951 Scanners require Java 11 --- .../src/main/java/org/sonar/application/App.java | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'sonar-application/src') diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java index aaea1090f12..bd4b19204e3 100644 --- a/sonar-application/src/main/java/org/sonar/application/App.java +++ b/sonar-application/src/main/java/org/sonar/application/App.java @@ -19,12 +19,9 @@ */ package org.sonar.application; -import org.sonar.api.SonarEdition; -import org.sonar.api.internal.MetadataLoader; import org.sonar.api.utils.log.Loggers; import org.sonar.application.command.CommandFactory; import org.sonar.application.command.CommandFactoryImpl; -import org.sonar.application.command.JavaVersion; import org.sonar.application.config.AppSettings; import org.sonar.application.config.AppSettingsLoader; import org.sonar.application.config.AppSettingsLoaderImpl; @@ -32,19 +29,14 @@ import org.sonar.core.extension.ServiceLoaderWrapper; import org.sonar.process.System2; import org.sonar.process.SystemExit; -import static com.google.common.base.Preconditions.checkState; import static org.sonar.application.config.SonarQubeVersionHelper.getSonarqubeVersion; import static org.sonar.process.ProcessProperties.Property.CLUSTER_NAME; public class App { private final SystemExit systemExit = new SystemExit(); - private final JavaVersion javaVersion; private StopRequestWatcher stopRequestWatcher = null; private StopRequestWatcher hardStopRequestWatcher = null; - public App(JavaVersion javaVersion) { - this.javaVersion = javaVersion; - } public void start(String[] cliArguments) { AppSettingsLoader settingsLoader = new AppSettingsLoaderImpl(System2.INSTANCE, cliArguments, new ServiceLoaderWrapper()); @@ -53,14 +45,13 @@ public class App { AppLogging logging = new AppLogging(settings); logging.configure(); AppFileSystem fileSystem = new AppFileSystem(settings); - checkJavaVersion(); try (AppState appState = new AppStateFactory(settings).create()) { appState.registerSonarQubeVersion(getSonarqubeVersion()); appState.registerClusterName(settings.getProps().nonNullValue(CLUSTER_NAME.getKey())); AppReloader appReloader = new AppReloaderImpl(settingsLoader, fileSystem, appState, logging); fileSystem.reset(); - CommandFactory commandFactory = new CommandFactoryImpl(settings.getProps(), fileSystem.getTempDir(), System2.INSTANCE, JavaVersion.INSTANCE); + CommandFactory commandFactory = new CommandFactoryImpl(settings.getProps(), fileSystem.getTempDir(), System2.INSTANCE); try (ProcessLauncher processLauncher = new ProcessLauncherImpl(fileSystem.getTempDir())) { Scheduler scheduler = new SchedulerImpl(settings, appReloader, commandFactory, processLauncher, appState); @@ -86,15 +77,8 @@ public class App { systemExit.exit(0); } - private void checkJavaVersion() { - if (MetadataLoader.loadEdition(org.sonar.api.utils.System2.INSTANCE) == SonarEdition.SONARCLOUD) { - return; - } - checkState(javaVersion.isAtLeastJava11(), "SonarQube requires Java 11 to run"); - } - public static void main(String[] args) throws Exception { - new App(JavaVersion.INSTANCE).start(args); + new App().start(args); } private class ShutdownHook extends Thread { -- cgit v1.2.3