From 17f3ad103edfbe03a1d4b2189524de89ba0c5ef1 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 10 Nov 2023 11:41:28 +0100 Subject: [PATCH] refactor(maven): Operate on sets of repositories This addresses an inspection hint about performance. Signed-off-by: Sebastian Schuberth --- .../maven/src/main/kotlin/utils/MavenSupport.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/package-managers/maven/src/main/kotlin/utils/MavenSupport.kt b/plugins/package-managers/maven/src/main/kotlin/utils/MavenSupport.kt index cac380af0bd08..573af4cf0a8f1 100644 --- a/plugins/package-managers/maven/src/main/kotlin/utils/MavenSupport.kt +++ b/plugins/package-managers/maven/src/main/kotlin/utils/MavenSupport.kt @@ -509,10 +509,10 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { val artifactDescriptorRequest = ArtifactDescriptorRequest(artifact, repositories, "project") val artifactDescriptorResult = repoSystem .readArtifactDescriptor(repositorySystemSession, artifactDescriptorRequest) - (repositories + artifactDescriptorResult.repositories).distinct() + repositories + artifactDescriptorResult.repositories } else { repositories - } + }.toSet() val cacheKey = "$artifact@$allRepositories" @@ -529,7 +529,7 @@ class MavenSupport(private val workspaceReader: WorkspaceReader) { val proxy = repositorySystemSession.proxySelector.getProxy(repository) val authentication = repositorySystemSession.authenticationSelector.getAuthentication(repository) RemoteRepository.Builder(repository).setAuthentication(authentication).setProxy(proxy).build() - } + }.toSet() if (allRepositories.size > remoteRepositories.size) { logger.debug { "Ignoring local repositories ${allRepositories - remoteRepositories}." }