]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12002 Fail startup if JRE < 11
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 15 May 2019 19:30:09 +0000 (14:30 -0500)
committersonartech <sonartech@sonarsource.com>
Fri, 28 Jun 2019 06:45:40 +0000 (08:45 +0200)
12 files changed:
server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java
server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java
server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java
server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java
server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java
server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java
server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java
server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
server/sonar-process/src/main/java/org/sonar/process/System2.java
sonar-application/src/main/java/org/sonar/application/App.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java
sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java

index 44a58d1d52d373f15b80900d5ea5676404899d0c..57e6e95b05289a2be30bd72db6addb30ab026752 100644 (file)
@@ -25,20 +25,19 @@ import java.util.Map;
 
 public class CeJvmOptions extends JvmOptions<CeJvmOptions> {
 
-  public CeJvmOptions(File tmpDir, JavaVersion javaVersion) {
-    super(mandatoryOptions(tmpDir, javaVersion));
+  public CeJvmOptions(File tmpDir) {
+    super(mandatoryOptions(tmpDir));
   }
 
-  private static Map<String, String> mandatoryOptions(File tmpDir, JavaVersion javaVersion) {
+  private static Map<String, String> mandatoryOptions(File tmpDir) {
     Map<String, String> res = new LinkedHashMap<>(3);
     res.put("-Djava.awt.headless=", "true");
     res.put("-Dfile.encoding=", "UTF-8");
     res.put("-Djava.io.tmpdir=", tmpDir.getAbsolutePath());
 
-    if (javaVersion.isAtLeastJava11()) {
-      // avoid illegal reflective access operations done by MyBatis
-      res.put("--add-opens=java.base/java.util=ALL-UNNAMED", "");
-    }
+    // avoid illegal reflective access operations done by MyBatis
+    res.put("--add-opens=java.base/java.util=ALL-UNNAMED", "");
+
     return res;
   }
 }
index 6e4a0aaea734b34db2e64b8be80de9c29feb566b..f254c255e20aef61073c95966b11f159995402e4 100644 (file)
@@ -72,13 +72,11 @@ public class CommandFactoryImpl implements CommandFactory {
   private final Props props;
   private final File tempDir;
   private final System2 system2;
-  private final JavaVersion javaVersion;
 
-  public CommandFactoryImpl(Props props, File tempDir, System2 system2, JavaVersion javaVersion) {
+  public CommandFactoryImpl(Props props, File tempDir, System2 system2) {
     this.props = props;
     this.tempDir = tempDir;
     this.system2 = system2;
-    this.javaVersion = javaVersion;
     String javaToolOptions = system2.getenv(ENV_VAR_JAVA_TOOL_OPTIONS);
     if (javaToolOptions != null && !javaToolOptions.trim().isEmpty()) {
       LoggerFactory.getLogger(CommandFactoryImpl.class)
@@ -153,7 +151,7 @@ public class CommandFactoryImpl implements CommandFactory {
   public JavaCommand createWebCommand(boolean leader) {
     File homeDir = props.nonNullValueAsFile(PATH_HOME.getKey());
 
-    WebJvmOptions jvmOptions = new WebJvmOptions(tempDir, javaVersion)
+    WebJvmOptions jvmOptions = new WebJvmOptions(tempDir)
       .addFromMandatoryProperty(props, WEB_JAVA_OPTS.getKey())
       .addFromMandatoryProperty(props, WEB_JAVA_ADDITIONAL_OPTS.getKey());
     addProxyJvmOptions(jvmOptions);
@@ -180,7 +178,7 @@ public class CommandFactoryImpl implements CommandFactory {
   public JavaCommand createCeCommand() {
     File homeDir = props.nonNullValueAsFile(PATH_HOME.getKey());
 
-    CeJvmOptions jvmOptions = new CeJvmOptions(tempDir, javaVersion)
+    CeJvmOptions jvmOptions = new CeJvmOptions(tempDir)
       .addFromMandatoryProperty(props, CE_JAVA_OPTS.getKey())
       .addFromMandatoryProperty(props, CE_JAVA_ADDITIONAL_OPTS.getKey());
     addProxyJvmOptions(jvmOptions);
index 05f87fe607730763db2c37f8a5af40e9a0dec307..7df9652ba12bed281e975e7fbe9358f86fe2ba51 100644 (file)
@@ -27,7 +27,6 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.stream.Collectors;
 import org.sonar.process.Props;
-import org.sonar.process.System2;
 
 public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
   private static final String ELASTICSEARCH_JVM_OPTIONS_HEADER = "# This file has been automatically generated by SonarQube during startup.\n" +
@@ -37,16 +36,12 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
     "\n";
 
   public EsJvmOptions(Props props, File tmpDir) {
-    this(System2.INSTANCE, props, tmpDir);
-  }
-
-  EsJvmOptions(System2 system2, Props props, File tmpDir) {
-    super(mandatoryOptions(system2, props, tmpDir));
+    super(mandatoryOptions(tmpDir, props));
   }
 
   // this basically writes down the content of jvm.options file distributed in vanilla Elasticsearch package
   // with some changes to fit running bundled in SQ
-  private static Map<String, String> mandatoryOptions(System2 system2, Props props, File tmpDir) {
+  private static Map<String, String> mandatoryOptions(File tmpDir, Props props) {
     Map<String, String> res = new LinkedHashMap<>(30);
     // GC configuration
     res.put("-XX:+UseConcMarkSweepGC", "");
@@ -115,16 +110,6 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
     // res.put("8:-XX:GCLogFileSize", "64m");
     // JDK 9+ GC logging
     // res.put("9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m", "");
-    // due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
-    // time/date parsing will break in an incompatible way for some date patterns and locals
-    if (system2.isJava9()) {
-      res.put("-Djava.locale.providers=", "COMPAT");
-    }
-
-    if (system2.isJava10()) {
-      // temporary workaround for C2 bug with JDK 10 on hardware with AVX-512
-      res.put("-XX:UseAVX=", "2");
-    }
 
     if (!props.value("sonar.jdbc.url", "").contains("jdbc:h2") && !props.valueAsBoolean("sonar.es.bootstrap.checks.disable")) {
       res.put("-Des.enforce.bootstrap.checks=", "true");
index 8e55debe854ef83dc6b5803db247cf1d25a04ee7..9b13df769de5f7d5531159be4f498a9bcfe16229 100644 (file)
@@ -24,25 +24,24 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 public class WebJvmOptions extends JvmOptions<WebJvmOptions> {
-  public WebJvmOptions(File tmpDir, JavaVersion javaVersion) {
-    super(mandatoryOptions(tmpDir, javaVersion));
+  public WebJvmOptions(File tmpDir) {
+    super(mandatoryOptions(tmpDir));
   }
 
-  private static Map<String, String> mandatoryOptions(File tmpDir, JavaVersion javaVersion) {
+  private static Map<String, String> mandatoryOptions(File tmpDir) {
     Map<String, String> res = new LinkedHashMap<>(3);
     res.put("-Djava.awt.headless=", "true");
     res.put("-Dfile.encoding=", "UTF-8");
     res.put("-Djava.io.tmpdir=", tmpDir.getAbsolutePath());
 
-    if (javaVersion.isAtLeastJava11()) {
-      // avoid illegal reflective access operations done by MyBatis
-      res.put("--add-opens=java.base/java.util=ALL-UNNAMED", "");
+    // avoid illegal reflective access operations done by MyBatis
+    res.put("--add-opens=java.base/java.util=ALL-UNNAMED", "");
+
+    // avoid illegal reflective access operations done by Tomcat
+    res.put("--add-opens=java.base/java.lang=ALL-UNNAMED", "");
+    res.put("--add-opens=java.base/java.io=ALL-UNNAMED", "");
+    res.put("--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED", "");
 
-      // avoid illegal reflective access operations done by Tomcat
-      res.put("--add-opens=java.base/java.lang=ALL-UNNAMED", "");
-      res.put("--add-opens=java.base/java.io=ALL-UNNAMED", "");
-      res.put("--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED", "");
-    }
     return res;
   }
 }
index 3cb6f5a81f9b94b22fc4d02bc7b9588937dd5e75..89ee9972281833671210a635d035d152f4b74da6 100644 (file)
@@ -27,39 +27,22 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class CeJvmOptionsTest {
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   private File tmpDir;
-  private JavaVersion javaVersion = mock(JavaVersion.class);
   private CeJvmOptions underTest;
 
   @Before
   public void setUp() throws IOException {
     tmpDir = temporaryFolder.newFolder();
-    underTest = new CeJvmOptions(tmpDir, javaVersion);
+    underTest = new CeJvmOptions(tmpDir);
   }
 
   @Test
-  public void constructor_sets_mandatory_JVM_options_before_java11() throws IOException {
-    when(javaVersion.isAtLeastJava11()).thenReturn(false);
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_before_java11() {
-    when(javaVersion.isAtLeastJava11()).thenReturn(false);
-    underTest = new CeJvmOptions(tmpDir, javaVersion);
-    assertThat(underTest.getAll()).containsExactly(
-      "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath());
-  }
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_for_java11() throws IOException {
-    when(javaVersion.isAtLeastJava11()).thenReturn(true);
-
+  public void constructor_sets_mandatory_JVM_options() {
     assertThat(underTest.getAll()).containsExactly(
       "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
       "--add-opens=java.base/java.util=ALL-UNNAMED");
index babc1e2204b44c7a4d0626b62dca5cf356db98e6..ff20bebcd0bff4ee0d580c84cbfb3761af94d3bf 100644 (file)
@@ -53,7 +53,6 @@ public class CommandFactoryImplTest {
   public TemporaryFolder temp = new TemporaryFolder();
 
   private System2 system2 = Mockito.mock(System2.class);
-  private JavaVersion javaVersion = Mockito.mock(JavaVersion.class);
   private File homeDir;
   private File tempDir;
   private File logsDir;
@@ -77,7 +76,7 @@ public class CommandFactoryImplTest {
   public void constructor_logs_no_warning_if_env_variable_JAVA_TOOL_OPTIONS_is_not_set() {
     attachMemoryAppenderToLoggerOf(CommandFactoryImpl.class);
 
-    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2, javaVersion);
+    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2);
 
     assertThat(listAppender.getLogs()).isEmpty();
   }
@@ -87,7 +86,7 @@ public class CommandFactoryImplTest {
     when(system2.getenv("JAVA_TOOL_OPTIONS")).thenReturn("sds");
     attachMemoryAppenderToLoggerOf(CommandFactoryImpl.class);
 
-    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2, javaVersion);
+    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2);
 
     assertThat(listAppender.getLogs())
       .extracting(ILoggingEvent::getMessage)
@@ -101,7 +100,7 @@ public class CommandFactoryImplTest {
     when(system2.getenv("ES_JAVA_OPTS")).thenReturn("xyz");
     attachMemoryAppenderToLoggerOf(CommandFactoryImpl.class);
 
-    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2, javaVersion);
+    new CommandFactoryImpl(new Props(new Properties()), tempDir, system2);
 
     assertThat(listAppender.getLogs())
       .extracting(ILoggingEvent::getMessage)
@@ -326,7 +325,7 @@ public class CommandFactoryImplTest {
     ServiceLoaderWrapper serviceLoaderWrapper = mock(ServiceLoaderWrapper.class);
     when(serviceLoaderWrapper.load()).thenReturn(ImmutableSet.of());
     new ProcessProperties(serviceLoaderWrapper).completeDefaults(props);
-    return new CommandFactoryImpl(props, tempDir, system2, javaVersion);
+    return new CommandFactoryImpl(props, tempDir, system2);
   }
 
   private <T> void attachMemoryAppenderToLoggerOf(Class<T> loggerClass) {
index f1a9b08552f60d5b39ae05de9c7bfc384469457b..83d310f0d05d32afd3c1674dbc536e52c5ebf463 100644 (file)
@@ -19,9 +19,7 @@
  */
 package org.sonar.application.command;
 
-import com.tngtech.java.junit.dataprovider.DataProvider;
 import com.tngtech.java.junit.dataprovider.DataProviderRunner;
-import com.tngtech.java.junit.dataprovider.UseDataProvider;
 import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
@@ -31,13 +29,10 @@ import org.junit.rules.ExpectedException;
 import org.junit.rules.TemporaryFolder;
 import org.junit.runner.RunWith;
 import org.sonar.process.Props;
-import org.sonar.process.System2;
 import org.sonar.test.ExceptionCauseMatcher;
 
 import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 @RunWith(DataProviderRunner.class)
 public class EsJvmOptionsTest {
@@ -49,10 +44,9 @@ public class EsJvmOptionsTest {
   private Properties properties = new Properties();
 
   @Test
-  @UseDataProvider("java8or11")
-  public void constructor_sets_mandatory_JVM_options_on_Java_8_and_11(System2 system2) throws IOException {
+  public void constructor_sets_mandatory_JVM_options_on_Java_11() throws IOException {
     File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(system2, new Props(properties), tmpDir);
+    EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
       .containsExactly(
@@ -78,128 +72,44 @@ public class EsJvmOptionsTest {
   }
 
   @Test
-  @UseDataProvider("java8or11")
-  public void constructor_does_not_force_boostrap_checks_if_sonarqube_property_is_true(System2 system2) throws IOException {
+  public void constructor_does_not_force_boostrap_checks_if_sonarqube_property_is_true() throws IOException {
     properties.put("sonar.es.bootstrap.checks.disable", "true");
     File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(system2, new Props(properties), tmpDir);
+    EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
       .doesNotContain("-Des.enforce.bootstrap.checks=true");
   }
 
   @Test
-  @UseDataProvider("java8or11")
-  public void constructor_forces_boostrap_checks_if_jdbc_url_property_does_not_exist(System2 system2) throws IOException {
+  public void constructor_forces_boostrap_checks_if_jdbc_url_property_does_not_exist() throws IOException {
     File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(system2, new Props(properties), tmpDir);
+    EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
       .contains("-Des.enforce.bootstrap.checks=true");
   }
 
   @Test
-  @UseDataProvider("java8or11")
-  public void constructor_forces_boostrap_checks_if_jdbc_url_property_is_not_h2(System2 system2) throws IOException {
+  public void constructor_forces_boostrap_checks_if_jdbc_url_property_is_not_h2() throws IOException {
     properties.put("sonar.jdbc.url", randomAlphanumeric(53));
     File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(system2, new Props(properties), tmpDir);
+    EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
       .contains("-Des.enforce.bootstrap.checks=true");
   }
 
   @Test
-  @UseDataProvider("java8or11")
-  public void constructor_does_not_force_boostrap_checks_if_jdbc_url_property_contains_h2(System2 system2) throws IOException {
+  public void constructor_does_not_force_boostrap_checks_if_jdbc_url_property_contains_h2() throws IOException {
     properties.put("sonar.jdbc.url", "jdbc:h2:tcp://ffoo:bar/sonar");
     File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(system2, new Props(properties), tmpDir);
+    EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
       .doesNotContain("-Des.enforce.bootstrap.checks=true");
   }
 
-  @DataProvider
-  public static Object[][] java8or11() {
-    System2 java8 = mock(System2.class);
-    when(java8.isJava9()).thenReturn(false);
-    when(java8.isJava10()).thenReturn(false);
-    System2 java10 = mock(System2.class);
-    when(java10.isJava9()).thenReturn(false);
-    when(java10.isJava10()).thenReturn(false);
-    return new Object[][] {
-      {java8},
-      {java10}
-    };
-  }
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_on_Java_9() throws IOException {
-    System2 java9 = mock(System2.class);
-    when(java9.isJava9()).thenReturn(true);
-    when(java9.isJava10()).thenReturn(false);
-
-    File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(java9, new Props(properties), tmpDir);
-
-    assertThat(underTest.getAll())
-      .containsExactly(
-        "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=75",
-        "-XX:+UseCMSInitiatingOccupancyOnly",
-        "-Des.networkaddress.cache.ttl=60",
-        "-Des.networkaddress.cache.negative.ttl=10",
-        "-XX:+AlwaysPreTouch",
-        "-Xss1m",
-        "-Djava.awt.headless=true",
-        "-Dfile.encoding=UTF-8",
-        "-Djna.nosys=true",
-        "-XX:-OmitStackTraceInFastThrow",
-        "-Dio.netty.noUnsafe=true",
-        "-Dio.netty.noKeySetOptimization=true",
-        "-Dio.netty.recycler.maxCapacityPerThread=0",
-        "-Dlog4j.shutdownHookEnabled=false",
-        "-Dlog4j2.disable.jmx=true",
-        "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
-        "-XX:ErrorFile=../logs/es_hs_err_pid%p.log",
-        "-Djava.locale.providers=COMPAT",
-        "-Des.enforce.bootstrap.checks=true");
-  }
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_on_Java_10() throws IOException {
-    System2 java10 = mock(System2.class);
-    when(java10.isJava9()).thenReturn(false);
-    when(java10.isJava10()).thenReturn(true);
-
-    File tmpDir = temporaryFolder.newFolder();
-    EsJvmOptions underTest = new EsJvmOptions(java10, new Props(properties), tmpDir);
-
-    assertThat(underTest.getAll())
-      .containsExactly(
-        "-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=75",
-        "-XX:+UseCMSInitiatingOccupancyOnly",
-        "-Des.networkaddress.cache.ttl=60",
-        "-Des.networkaddress.cache.negative.ttl=10",
-        "-XX:+AlwaysPreTouch",
-        "-Xss1m",
-        "-Djava.awt.headless=true",
-        "-Dfile.encoding=UTF-8",
-        "-Djna.nosys=true",
-        "-XX:-OmitStackTraceInFastThrow",
-        "-Dio.netty.noUnsafe=true",
-        "-Dio.netty.noKeySetOptimization=true",
-        "-Dio.netty.recycler.maxCapacityPerThread=0",
-        "-Dlog4j.shutdownHookEnabled=false",
-        "-Dlog4j2.disable.jmx=true",
-        "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
-        "-XX:ErrorFile=../logs/es_hs_err_pid%p.log",
-        "-XX:UseAVX=2",
-        "-Des.enforce.bootstrap.checks=true");
-  }
-
   /**
    * This test may fail if SQ's test are not executed with target Java version 8.
    */
index 65def9d351921a000f04a06c0014190f7a5fbebb..2d647b6dc8d7b6d4caba2d609c6fbb7377e67af4 100644 (file)
@@ -27,39 +27,22 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class WebJvmOptionsTest {
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   private File tmpDir;
-  private JavaVersion javaVersion = mock(JavaVersion.class);
   private WebJvmOptions underTest;
 
   @Before
   public void setUp() throws IOException {
     tmpDir = temporaryFolder.newFolder();
-    underTest = new WebJvmOptions(tmpDir, javaVersion);
+    underTest = new WebJvmOptions(tmpDir);
   }
 
   @Test
-  public void constructor_sets_mandatory_JVM_options_before_java11() throws IOException {
-    when(javaVersion.isAtLeastJava11()).thenReturn(false);
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_before_java11() {
-    when(javaVersion.isAtLeastJava11()).thenReturn(false);
-    underTest = new WebJvmOptions(tmpDir, javaVersion);
-    assertThat(underTest.getAll()).containsExactly(
-      "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath());
-  }
-
-  @Test
-  public void constructor_sets_mandatory_JVM_options_for_java11() throws IOException {
-    when(javaVersion.isAtLeastJava11()).thenReturn(true);
-
+  public void constructor_sets_mandatory_JVM_options() {
     assertThat(underTest.getAll()).containsExactly(
       "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
       "--add-opens=java.base/java.util=ALL-UNNAMED",
@@ -67,5 +50,4 @@ public class WebJvmOptionsTest {
       "--add-opens=java.base/java.io=ALL-UNNAMED",
       "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED");
   }
-
 }
index e74ba7d4deabd405d8b65e36dfccef85ae446f95..93a46cc3dd0179837429cfb74fce35acf8a120c2 100644 (file)
@@ -41,14 +41,6 @@ public interface System2 {
     public boolean isOsWindows() {
       return SystemUtils.IS_OS_WINDOWS;
     }
-
-    public boolean isJava9() {
-      return SystemUtils.JAVA_VERSION != null && SystemUtils.JAVA_VERSION.startsWith("9");
-    }
-
-    public boolean isJava10() {
-      return SystemUtils.JAVA_VERSION != null && SystemUtils.JAVA_VERSION.startsWith("10");
-    }
   };
 
   /**
@@ -65,14 +57,4 @@ public interface System2 {
    * True if this is MS Windows.
    */
   boolean isOsWindows();
-
-  /**
-   * True is current Java version is Java 9.
-   */
-  boolean isJava9();
-
-  /**
-   * True is current Java version is Java 10.
-   */
-  boolean isJava10();
 }
index 9133001ecda02ae4ac61d2c3f12fa6f6e97e10d1..f9e7fe288fc0a57973a25942b4187003ab4ecac0 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.application;
 
 import java.io.IOException;
-import org.slf4j.LoggerFactory;
 import org.sonar.api.SonarEdition;
 import org.sonar.api.internal.MetadataLoader;
 import org.sonar.application.command.CommandFactory;
@@ -61,7 +60,7 @@ public class App {
       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);
@@ -91,7 +90,7 @@ public class App {
     }
 
     if (!javaVersion.isAtLeastJava11()) {
-      LoggerFactory.getLogger(this.getClass()).warn("SonarQube will require Java 11+ starting on next version");
+      throw new IllegalStateException("SonarQube requires Java 11+ to run");
     }
   }
 
index e600bf3b3b75daa73fb3e2263bdae246cdaaf842..0076875aa49fbf56f82775d34a8eaaa0f0bfe473 100644 (file)
@@ -83,7 +83,7 @@ public class GlobalContainer extends ComponentContainer {
     try {
       String.class.getMethod("isBlank");
     } catch (NoSuchMethodException e) {
-      LOG.warn("SonarQube scanners will require Java 11+ starting on next version");
+      throw new IllegalStateException("SonarScanner requires Java 11+ to run");
     }
   }
 
index 45533360e7074456c086febd2657303748d10a04..c568cc54abf303eb2d28269aabeb5506ed9437d1 100644 (file)
@@ -49,7 +49,6 @@ import static org.sonarqube.ws.WsUtils.nullToEmpty;
 
 /**
  * Connect to any SonarQube server available through HTTP or HTTPS.
- * <p>TLS 1.0, 1.1 and 1.2 are supported on both Java 7 and 8. SSLv3 is not supported.</p>
  * <p>The JVM system proxies are used.</p>
  */
 public class HttpConnector implements WsConnector {