From 6c2b7ab4f4e1a094f59f72d71ea684dcbae7462d Mon Sep 17 00:00:00 2001 From: Nicolas QUINQUENEL Date: Tue, 24 Sep 2024 10:59:10 +0200 Subject: [PATCH] SLI-1611 Tune the Garbage Collector --- gradle/libs.versions.toml | 2 +- .../org/sonarlint/intellij/SonarLintIntelliJClient.kt | 6 ++++-- .../java/org/sonarlint/intellij/core/BackendService.kt | 9 +++++++-- .../org/sonarlint/intellij/core/BackendServiceTests.kt | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c8351d214d..35dcaa1458 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -sonarlint-core = "10.5.0.78949" +sonarlint-core = "10.6.0.79030" sonar-java = "8.1.0.36477" sonar-javascript = "10.15.0.27423" diff --git a/src/main/java/org/sonarlint/intellij/SonarLintIntelliJClient.kt b/src/main/java/org/sonarlint/intellij/SonarLintIntelliJClient.kt index 0dcc705243..72bdfd4aff 100644 --- a/src/main/java/org/sonarlint/intellij/SonarLintIntelliJClient.kt +++ b/src/main/java/org/sonarlint/intellij/SonarLintIntelliJClient.kt @@ -124,6 +124,7 @@ import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.Bindin import org.sonarsource.sonarlint.core.rpc.protocol.backend.tracking.TaintVulnerabilityDto import org.sonarsource.sonarlint.core.rpc.protocol.client.binding.AssistBindingParams import org.sonarsource.sonarlint.core.rpc.protocol.client.binding.AssistBindingResponse +import org.sonarsource.sonarlint.core.rpc.protocol.client.binding.NoBindingSuggestionFoundParams import org.sonarsource.sonarlint.core.rpc.protocol.client.connection.AssistCreatingConnectionParams import org.sonarsource.sonarlint.core.rpc.protocol.client.connection.AssistCreatingConnectionResponse import org.sonarsource.sonarlint.core.rpc.protocol.client.connection.ConnectionSuggestionDto @@ -575,10 +576,11 @@ object SonarLintIntelliJClient : SonarLintRpcClientDelegate { } } - override fun noBindingSuggestionFound(projectKey: String) { + override fun noBindingSuggestionFound(params: NoBindingSuggestionFoundParams) { + val serverType = if (params.isSonarCloud) "SonarCloud" else "SonarQube" projectLessNotification( "No matching open project found", - "IntelliJ cannot match SonarQube project '$projectKey' to any of the currently open projects. Please open your project and try again.", + "IntelliJ cannot match $serverType project '${params.projectKey}' to any of the currently open projects. Please open your project and try again.", NotificationType.WARNING, OpenInBrowserAction("Open Troubleshooting Documentation", null, TROUBLESHOOTING_CONNECTED_MODE_SETUP_LINK) ) diff --git a/src/main/java/org/sonarlint/intellij/core/BackendService.kt b/src/main/java/org/sonarlint/intellij/core/BackendService.kt index 378e433195..b6a9194020 100644 --- a/src/main/java/org/sonarlint/intellij/core/BackendService.kt +++ b/src/main/java/org/sonarlint/intellij/core/BackendService.kt @@ -273,7 +273,11 @@ class BackendService : Disposable { sloopPath.toFile().walkTopDown().forEach { file -> getService(GlobalLogOutput::class.java).log(file.absolutePath, ClientLogOutput.Level.INFO) } - return sloopLauncher.start(sloopPath, Paths.get(jreHomePath)) + return sloopLauncher.start( + sloopPath, + Paths.get(jreHomePath), + "-Xms384m -XX:+UseG1GC -XX:MaxHeapFreeRatio=20 -XX:MinHeapFreeRatio=10 -XX:+UseStringDeduplication -XX:MaxGCPauseMillis=50 -XX:ParallelGCThreads=2" + ) } private fun listenForProcessExit(sloopProcess: Sloop) { @@ -344,7 +348,8 @@ class BackendService : Disposable { nonDefaultRpcRulesConfigurationByKey, getGlobalSettings().isFocusOnNewCode, LanguageSpecificRequirements(nodeJsPath, omnisharpRequirementsDto), - false + false, + null ) ) } diff --git a/src/test/java/org/sonarlint/intellij/core/BackendServiceTests.kt b/src/test/java/org/sonarlint/intellij/core/BackendServiceTests.kt index 294aa5a9c8..915921e40f 100644 --- a/src/test/java/org/sonarlint/intellij/core/BackendServiceTests.kt +++ b/src/test/java/org/sonarlint/intellij/core/BackendServiceTests.kt @@ -88,7 +88,7 @@ class BackendServiceTests : AbstractSonarLintHeavyTests() { `when`(sloop.rpcServer).thenReturn(backend) `when`(sloop.onExit()).thenReturn(CompletableFuture.completedFuture(null)) val sloopLauncher = mock(SloopLauncher::class.java) - `when`(sloopLauncher.start(any(), any())).thenReturn(sloop) + `when`(sloopLauncher.start(any(), any(), any())).thenReturn(sloop) service = BackendService(sloopLauncher) ApplicationManager.getApplication().replaceService(BackendService::class.java, service, testRootDisposable) }