diff --git a/platform/core-api/src/com/intellij/idea/AppMode.java b/platform/core-api/src/com/intellij/idea/AppMode.java index f6ddac63f1a4..ce7c8614561c 100644 --- a/platform/core-api/src/com/intellij/idea/AppMode.java +++ b/platform/core-api/src/com/intellij/idea/AppMode.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.idea; import org.jetbrains.annotations.ApiStatus; @@ -140,7 +140,7 @@ public final class AppMode { "keymap", "update", "inspections", "intentions", "rdserver-headless", "thinClient-headless", "installPlugins", "dumpActions", "cwmHostStatus", "remoteDevStatus", "invalidateCaches", "warmup", "buildEventsScheme", "inspectopedia-generator", "remoteDevShowHelp", "installGatewayProtocolHandler", "uninstallGatewayProtocolHandler", "appcodeClangModulesDiff", "appcodeClangModulesPrinter", "exit", - "qodanaExcludedPlugins"); + "qodanaExcludedPlugins", "project-with-shared-caches"); return headlessCommands.contains(firstArg) || firstArg.length() < 20 && firstArg.endsWith("inspect"); } diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt index 2e34e6309d12..14ab8f53ef98 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/DialogAppender.kt @@ -14,20 +14,10 @@ import java.util.* import java.util.logging.Handler import java.util.logging.Level import java.util.logging.LogRecord -import kotlin.concurrent.Volatile @ApiStatus.Internal class DialogAppender : Handler() { - companion object { - //TODO android update checker accesses project jdk, fix it and remove - fun delayPublishingForcibly() { - delay = true - } - - fun stopForceDelaying() { - delay = false - } - } + private val MAX_EARLY_LOGGING_EVENTS = 20 private var earlyEventCounter = 0 private val earlyEvents = ArrayDeque() @@ -52,7 +42,7 @@ class DialogAppender : Handler() { } synchronized(this) { - if (LoadingState.COMPONENTS_LOADED.isOccurred && !delay) { + if (LoadingState.APP_READY.isOccurred) { processEarlyEventsIfNeeded() queueAppend(ideaEvent) } @@ -89,34 +79,29 @@ class DialogAppender : Handler() { } } - override fun flush() {} + override fun flush() { } - override fun close() {} -} + override fun close() { } -@Volatile -private var delay = false - -private const val MAX_EARLY_LOGGING_EVENTS = 20 - -private fun extractLoggingEvent(messageObject: Any?, throwable: Throwable): IdeaLoggingEvent { - var message: String? = null - val withAttachments = ExceptionUtil.findCauseAndSuppressed(throwable, ExceptionWithAttachments::class.java) - (withAttachments.firstOrNull() as? RuntimeExceptionWithAttachments)?.let { - message = it.userMessage - } - if (message == null && messageObject != null) { - message = messageObject.toString() - } - - if (withAttachments.isEmpty()) { - return IdeaLoggingEvent(message, throwable) - } - else { - val list = ArrayList() - for (e in withAttachments) { - list.addAll(e.attachments) + private fun extractLoggingEvent(messageObject: Any?, throwable: Throwable): IdeaLoggingEvent { + var message: String? = null + val withAttachments = ExceptionUtil.findCauseAndSuppressed(throwable, ExceptionWithAttachments::class.java) + (withAttachments.firstOrNull() as? RuntimeExceptionWithAttachments)?.let { + message = it.userMessage + } + if (message == null && messageObject != null) { + message = messageObject.toString() + } + + if (withAttachments.isEmpty()) { + return IdeaLoggingEvent(message, throwable) + } + else { + val list = ArrayList() + for (e in withAttachments) { + list.addAll(e.attachments) + } + return LogMessage.eventOf(throwable, message, list) } - return LogMessage.eventOf(throwable, message, list) } } diff --git a/platform/util/base/src/com/intellij/diagnostic/LoadingState.java b/platform/util/base/src/com/intellij/diagnostic/LoadingState.java index 9423def8722e..9c655628855f 100644 --- a/platform/util/base/src/com/intellij/diagnostic/LoadingState.java +++ b/platform/util/base/src/com/intellij/diagnostic/LoadingState.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.diagnostic; import org.jetbrains.annotations.ApiStatus; @@ -15,9 +15,7 @@ public enum LoadingState { COMPONENTS_REGISTERED("app component registered"), CONFIGURATION_STORE_INITIALIZED("app store initialized"), COMPONENTS_LOADED("app component loaded"), - /** - * Application and LaF are ready, but it's too early for the post-startup activities, yet. - */ + /** Application and LaF are ready, but it's too early for the post-startup activities, still. */ APP_READY("app ready"), APP_STARTED("app started"), PROJECT_OPENED("project opened"); @@ -85,7 +83,6 @@ public enum LoadingState { if (this == obj) { return true; } - if (obj instanceof ThrowableWrapper) { Throwable throwable = ((ThrowableWrapper)obj).throwable; return this.throwable == throwable || fingerprint(this.throwable).equals(fingerprint(throwable));