Always remove configure notifications without additional checks in tests (KT-23399)
For some reason there were ~1000 tests that were spontaneously
falling (~20%) because they couldn't find some class. It was mostly
Java classes.
Those failures started after cff88a3f8b.
There were group of commits about notifications right before it:
b4fb0e0305b77a0caa83d34edac3253b7d8e082b..1be33b91fa85e50f5048dc5a12604debfa3c19e8
#KT-23399 Fixed
This commit is contained in:
+20
-11
@@ -70,19 +70,28 @@ fun checkHideNonConfiguredNotifications(project: Project) {
|
||||
DumbService.getInstance(project).waitForSmartMode()
|
||||
val moduleSourceRootMap = ModuleSourceRootMap(project)
|
||||
|
||||
val hideNotification = try {
|
||||
val moduleSourceRootGroups = notification.notificationState.notConfiguredModules
|
||||
.mapNotNull { ModuleManager.getInstance(project).findModuleByName(it) }
|
||||
.map { moduleSourceRootMap.getWholeModuleGroup(it) }
|
||||
moduleSourceRootGroups.none(::isNotConfiguredNotificationRequired)
|
||||
} catch (e: IndexNotReadyException) {
|
||||
checkInProgress.set(false)
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
checkHideNonConfiguredNotifications(project)
|
||||
}
|
||||
return@executeOnPooledThread
|
||||
if (notification.notificationState.debugProjectName != project.name) {
|
||||
LOG.error("Bad notification check for project: ${project.name}\n${notification.notificationState}")
|
||||
}
|
||||
|
||||
val hideNotification =
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||
try {
|
||||
val moduleSourceRootGroups = notification.notificationState.notConfiguredModules
|
||||
.mapNotNull { ModuleManager.getInstance(project).findModuleByName(it) }
|
||||
.map { moduleSourceRootMap.getWholeModuleGroup(it) }
|
||||
moduleSourceRootGroups.none(::isNotConfiguredNotificationRequired)
|
||||
} catch (e: IndexNotReadyException) {
|
||||
checkInProgress.set(false)
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
checkHideNonConfiguredNotifications(project)
|
||||
}
|
||||
return@executeOnPooledThread
|
||||
}
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
||||
if (hideNotification) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
ConfigureKotlinNotificationManager.expireOldNotifications(project)
|
||||
|
||||
+2
@@ -48,6 +48,8 @@ class KotlinConfigurationCheckerComponent(project: Project) : AbstractProjectCom
|
||||
val connection = project.messageBus.connect()
|
||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener {
|
||||
override fun rootsChanged(event: ModuleRootEvent?) {
|
||||
if (!project.isInitialized) return
|
||||
|
||||
if (notificationPostponed && !isSyncing) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread {
|
||||
DumbService.getInstance(myProject).waitForSmartMode()
|
||||
|
||||
+2
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComp
|
||||
import javax.swing.event.HyperlinkEvent
|
||||
|
||||
data class ConfigureKotlinNotificationState(
|
||||
val debugProjectName: String,
|
||||
val notificationString: String,
|
||||
val notConfiguredModules: Collection<String>
|
||||
)
|
||||
@@ -64,6 +65,7 @@ class ConfigureKotlinNotification(
|
||||
}
|
||||
|
||||
return ConfigureKotlinNotificationState(
|
||||
project.name,
|
||||
"Configure $modulesString in '${project.name}' project<br/> $links",
|
||||
configurableModules.map { it.baseModule.name }
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user