[platform] IJPL-174111 Stop spamming user logs with warnings on development time problems

GitOrigin-RevId: 6baeb5b2f47cf95a7d783d30988121889c607e9b
This commit is contained in:
Yuriy Artamonov
2024-12-22 20:12:11 +00:00
committed by intellij-monorepo-bot
parent aef7f172c2
commit edad1fb02c
2 changed files with 10 additions and 9 deletions
@@ -12,7 +12,6 @@ import com.intellij.openapi.application.*
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.Cancellation
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.wm.IdeFrame
import com.intellij.util.concurrency.ThreadingAssertions
@@ -89,8 +88,12 @@ open class Alarm @Internal constructor(
@Deprecated("Please use flow or at least pass coroutineScope")
constructor() : this(threadToUse = ThreadToUse.SWING_THREAD, parentDisposable = null, activationComponent = null) {
val stackFrames = StackWalker.getInstance().walk { stream -> stream.asSequence().drop(1).firstOrNull()?.toString() }
LOG.warn("Do not create alarm without coroutineScope: $stackFrames")
val application = ApplicationManager.getApplication()
if (application == null || application.isUnitTestMode || application.isInternal) {
val stackFrames = StackWalker.getInstance().walk { stream -> stream.asSequence().drop(1).firstOrNull()?.toString() } ?: ""
// logged only during development, let's not spam users
LOG.warn("Do not create alarm without coroutineScope: $stackFrames")
}
}
@Internal
@@ -16,7 +16,6 @@ import com.intellij.diagnostic.PluginException
import com.intellij.diagnostic.StartUpMeasurer
import com.intellij.ide.plugins.*
import com.intellij.ide.plugins.cl.PluginAwareClassLoader
import com.intellij.idea.AppMode.isDevServer
import com.intellij.idea.AppMode.isLightEdit
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.*
@@ -862,8 +861,8 @@ abstract class ComponentManagerImpl(
// => but [parentDisposable] is [UsefulTestCase.getTestRootDisposable] which might be disposed after the fixture.
//
// This indicates a problem with scoping.
// The [parentDisposable] should be disposed on the same level as the code which replaces the service, i.e.,
// if the service is registered in a [setUp] method before a test,
// The [parentDisposable] should be disposed on the same level as the code which replaces the service.
// If the service is registered in a [setUp] method before a test,
// then the [parentDisposable] should be disposed in [tearDown] right after the test.
// In other words, it's generally incorrect to use [UsefulTestCase.getTestRootDisposable]
// as a [parentDisposable] for the replacement service.
@@ -1065,9 +1064,8 @@ abstract class ComponentManagerImpl(
LOG.error(PluginException(message, plugin.pluginId))
}
else if (!isKnown || !impl.startsWith("com.intellij.")) {
if (ApplicationManager.getApplication().isUnitTestMode
|| PluginManagerCore.isRunningFromSources()
|| isDevServer()) {
val application = ApplicationManager.getApplication()
if (application == null || application.isUnitTestMode || application.isInternal) {
// logged only during development, let's not spam users
LOG.warn(message)
}