diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2020-05-12 13:52:39 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-06-09 20:03:05 +0000 |
commit | 41d73907d9cf4b08c7483a6a07d5ad4efaf13f84 (patch) | |
tree | e20a82cf47a80f063c967562e8a3389d6891f787 /sonar-scanner-engine | |
parent | ef7557b75dec680b0bed940f87e52023720b8a53 (diff) | |
download | sonarqube-41d73907d9cf4b08c7483a6a07d5ad4efaf13f84.tar.gz sonarqube-41d73907d9cf4b08c7483a6a07d5ad4efaf13f84.zip |
SONAR-14951 Scanners require Java 11
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/ProjectInfo.java | 2 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java | 14 |
2 files changed, 1 insertions, 15 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ProjectInfo.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ProjectInfo.java index bd1028670f9..dea7bdfc6e1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ProjectInfo.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ProjectInfo.java @@ -66,7 +66,7 @@ public class ProjectInfo implements Startable { private Date loadAnalysisDate() { Optional<String> value = settings.get(CoreProperties.PROJECT_DATE_PROPERTY); - if (!value.isPresent()) { + if (value.isEmpty()) { return Date.from(clock.instant()); } try { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java index e8aee0067b9..dfc5047dd19 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java @@ -31,7 +31,6 @@ import org.sonar.api.SonarQubeVersion; import org.sonar.api.SonarRuntime; import org.sonar.api.internal.MetadataLoader; import org.sonar.api.internal.SonarRuntimeImpl; -import org.sonar.api.notifications.AnalysisWarnings; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; @@ -83,23 +82,10 @@ public class GlobalContainer extends ComponentContainer { addBootstrapComponents(); } - private static void checkJavaVersion(AnalysisWarnings analysisWarnings) { - try { - String.class.getMethod("isBlank"); - } catch (NoSuchMethodException e) { - LOG.warn("SonarScanner will require Java 11 to run, starting in SonarQube 9.x"); - analysisWarnings.addUnique("SonarScanner will require Java 11 to run, starting in SonarQube 9.x. Please upgrade the version of Java that executes the scanner and " + - "refer to <a href=\"/documentation/analysis/analysis-with-java-11/\" target=\"_blank\">the documentation</a> if needed."); - } - } - private void addBootstrapComponents() { Version apiVersion = MetadataLoader.loadVersion(System2.INSTANCE); SonarEdition edition = MetadataLoader.loadEdition(System2.INSTANCE); DefaultAnalysisWarnings analysisWarnings = new DefaultAnalysisWarnings(System2.INSTANCE); - if (edition != SonarEdition.SONARCLOUD) { - checkJavaVersion(analysisWarnings); - } LOG.debug("{} {}", edition.getLabel(), apiVersion); add( // plugins |