diff --git a/java/compiler/impl/src/com/intellij/compiler/cache/CompilerCacheStartupActivity.kt b/java/compiler/impl/src/com/intellij/compiler/cache/CompilerCacheStartupActivity.kt index f615ca5e00ed..d1acf61b426c 100644 --- a/java/compiler/impl/src/com/intellij/compiler/cache/CompilerCacheStartupActivity.kt +++ b/java/compiler/impl/src/com/intellij/compiler/cache/CompilerCacheStartupActivity.kt @@ -1,6 +1,7 @@ // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.compiler.cache +import com.intellij.compiler.cache.client.CompilerCacheServerAuthService import com.intellij.compiler.cache.client.JpsServerAuthExtension import com.intellij.compiler.cache.git.GitRepositoryUtil import com.intellij.compiler.cache.ui.CompilerCacheNotifications @@ -22,7 +23,7 @@ internal class CompilerCacheStartupActivity : ProjectActivity { thisLogger().debug("Not an Intellij project, JPS Caches will not be available") return } - JpsServerAuthExtension.checkAuthenticated(project, project) { + JpsServerAuthExtension.checkAuthenticated(CompilerCacheServerAuthService.getInstance(project), project) { thisLogger().info("User authentication for JPS Cache download complete successfully") } checkWindowsCRLF(project) diff --git a/java/compiler/impl/src/com/intellij/compiler/cache/client/CompilerCacheServerAuthService.kt b/java/compiler/impl/src/com/intellij/compiler/cache/client/CompilerCacheServerAuthService.kt index dd99946023e5..5a4d553791bd 100644 --- a/java/compiler/impl/src/com/intellij/compiler/cache/client/CompilerCacheServerAuthService.kt +++ b/java/compiler/impl/src/com/intellij/compiler/cache/client/CompilerCacheServerAuthService.kt @@ -4,6 +4,7 @@ package com.intellij.compiler.cache.client import com.intellij.compiler.cache.client.JpsServerAuthExtension.Companion.getInstance import com.intellij.compiler.cache.ui.CompilerCacheNotifications import com.intellij.notification.NotificationType +import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.compiler.JavaCompilerBundle import com.intellij.openapi.components.Service @@ -14,7 +15,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch @Service(Service.Level.PROJECT) -class CompilerCacheServerAuthService(private val project: Project, private val scope: CoroutineScope) { +class CompilerCacheServerAuthService(private val project: Project, private val scope: CoroutineScope) : Disposable { fun getRequestHeaders(): Map { return getRequestHeaders(false) } @@ -32,7 +33,7 @@ class CompilerCacheServerAuthService(private val project: Project, private val s val authHeader = authExtension.getAuthHeader(force) if (authHeader == null) { scope.launch { - JpsServerAuthExtension.checkAuthenticated(project, project) { + JpsServerAuthExtension.checkAuthenticated(getInstance(project), project) { thisLogger().info("User authentication for JPS Cache download complete successfully") } } @@ -45,4 +46,7 @@ class CompilerCacheServerAuthService(private val project: Project, private val s @JvmStatic fun getInstance(project: Project): CompilerCacheServerAuthService = project.service() } + + override fun dispose() { + } } diff --git a/java/compiler/impl/src/com/intellij/compiler/cache/client/JpsServerAuthExtension.kt b/java/compiler/impl/src/com/intellij/compiler/cache/client/JpsServerAuthExtension.kt index ee55e43fc0e0..98b7028d26ff 100644 --- a/java/compiler/impl/src/com/intellij/compiler/cache/client/JpsServerAuthExtension.kt +++ b/java/compiler/impl/src/com/intellij/compiler/cache/client/JpsServerAuthExtension.kt @@ -52,7 +52,7 @@ interface JpsServerAuthExtension { if (authExtension == null) { val userData = project.getUserData(NOTIFICATION_SHOWN_KEY) if (userData == null) { - project.putUserData(NOTIFICATION_SHOWN_KEY, java.lang.Boolean.TRUE) + project.putUserData(NOTIFICATION_SHOWN_KEY, true) withContext(Dispatchers.EDT) { CompilerCacheNotifications.ATTENTION .createNotification(JavaCompilerBundle.message("notification.title.jps.caches.downloader"),