mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[platform] extract diagnostic util module
GitOrigin-RevId: 83cc6a2b2885d04face03fcf6d796889c0f47cdc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e9d019b28b
commit
bb251bc85d
Generated
+1
@@ -709,6 +709,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/intellij.platform.util.iml" filepath="$PROJECT_DIR$/platform/util/intellij.platform.util.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" filepath="$PROJECT_DIR$/platform/util-class-loader/intellij.platform.util.classLoader.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/collections/intellij.platform.util.collections.iml" filepath="$PROJECT_DIR$/platform/util/collections/intellij.platform.util.collections.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/diagnostic/intellij.platform.util.diagnostic.iml" filepath="$PROJECT_DIR$/platform/util/diagnostic/intellij.platform.util.diagnostic.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" filepath="$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" filepath="$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/strings/intellij.platform.util.strings.iml" filepath="$PROJECT_DIR$/platform/util/strings/intellij.platform.util.strings.iml" />
|
||||
|
||||
@@ -26,6 +26,7 @@ class CommunityStandaloneJpsBuilder {
|
||||
module("intellij.platform.util.text.matching")
|
||||
module("intellij.platform.util.collections")
|
||||
module("intellij.platform.util.strings")
|
||||
module("intellij.platform.util.diagnostic")
|
||||
}
|
||||
|
||||
jar("jps-launcher.jar") {
|
||||
|
||||
@@ -34,6 +34,7 @@ class IntelliJCoreArtifactsBuilder {
|
||||
"intellij.platform.util.text.matching",
|
||||
"intellij.platform.util.collections",
|
||||
"intellij.platform.util.strings",
|
||||
"intellij.platform.util.diagnostic",
|
||||
"intellij.platform.util.classLoader",
|
||||
"intellij.xml.analysis",
|
||||
"intellij.xml.psi",
|
||||
@@ -112,6 +113,7 @@ class IntelliJCoreArtifactsBuilder {
|
||||
module("intellij.platform.util.text.matching")
|
||||
module("intellij.platform.util.collections")
|
||||
module("intellij.platform.util.strings")
|
||||
module("intellij.platform.util.diagnostic")
|
||||
module("intellij.platform.util")
|
||||
module("intellij.platform.core")
|
||||
module("intellij.platform.core.impl")
|
||||
|
||||
+1
@@ -151,6 +151,7 @@ class DistributionJARsBuilder {
|
||||
addModule("intellij.platform.util.text.matching", "util.jar")
|
||||
addModule("intellij.platform.util.collections", "util.jar")
|
||||
addModule("intellij.platform.util.strings", "util.jar")
|
||||
addModule("intellij.platform.util.diagnostic", "util.jar")
|
||||
addModule("intellij.platform.util.ui")
|
||||
addModule("intellij.platform.util.ex")
|
||||
addModule("intellij.platform.rd.community")
|
||||
|
||||
@@ -164,6 +164,7 @@ public final class StartupUtil {
|
||||
|
||||
public static void prepareApp(@NotNull String @NotNull [] args, @NotNull String mainClass) throws Exception {
|
||||
LoadingState.setStrictMode();
|
||||
LoadingState.setErrorHandler((message, throwable) -> Logger.getInstance(LoadingState.class).error(message, throwable));
|
||||
|
||||
Activity activity = StartUpMeasurer.startMainActivity("ForkJoin CommonPool configuration");
|
||||
IdeaForkJoinWorkerThreadFactory.setupForkJoinCommonPool(Main.isHeadless(args));
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="jetbrains-annotations" level="project" />
|
||||
<orderEntry type="library" name="fastutil-min" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.diagnostic;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
+22
-12
@@ -1,13 +1,14 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.diagnostic;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public enum LoadingState {
|
||||
@@ -22,6 +23,7 @@ public enum LoadingState {
|
||||
|
||||
final String displayName;
|
||||
|
||||
private static BiConsumer<String, Throwable> errorHandler;
|
||||
private static boolean CHECK_LOADING_PHASE;
|
||||
private static Set<Throwable> stackTraces;
|
||||
|
||||
@@ -29,9 +31,14 @@ public enum LoadingState {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static Logger getLogger() {
|
||||
return Logger.getInstance(LoadingState.class);
|
||||
@Nullable
|
||||
static BiConsumer<String, Throwable> getErrorHandler() {
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setErrorHandler(@NotNull BiConsumer<String, Throwable> errorHandler) {
|
||||
LoadingState.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -56,9 +63,9 @@ public enum LoadingState {
|
||||
Throwable t = new Throwable();
|
||||
if (stackTraces == null) {
|
||||
//noinspection AssignmentToStaticFieldFromInstanceMethod
|
||||
stackTraces = new THashSet<>(new TObjectHashingStrategy<Throwable>() {
|
||||
stackTraces = new ObjectOpenCustomHashSet<>(new Hash.Strategy<Throwable>() {
|
||||
@Override
|
||||
public int computeHashCode(Throwable throwable) {
|
||||
public int hashCode(Throwable throwable) {
|
||||
return fingerprint(throwable).hashCode();
|
||||
}
|
||||
|
||||
@@ -81,9 +88,12 @@ public enum LoadingState {
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().error("Should be called at least in the state " + this + ", the current state is: " + currentState + "\n" +
|
||||
"Current violators count: " + stackTraces.size() + "\n\n",
|
||||
t);
|
||||
BiConsumer<String, Throwable> errorHandler = getErrorHandler();
|
||||
if (errorHandler != null) {
|
||||
errorHandler.accept("Should be called at least in the state " + this + ", the current state is: " + currentState + "\n" +
|
||||
"Current violators count: " + stackTraces.size() + "\n\n",
|
||||
t);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isKnownViolator() {
|
||||
+6
-2
@@ -9,6 +9,7 @@ import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class StartUpMeasurer {
|
||||
@@ -152,8 +153,11 @@ public final class StartUpMeasurer {
|
||||
|
||||
public static void setCurrentState(@NotNull LoadingState state) {
|
||||
LoadingState old = currentState.getAndSet(state);
|
||||
if (old.compareTo(state)>0) {
|
||||
LoadingState.getLogger().error("New state " + state + " cannot precede old " + old);
|
||||
if (old.compareTo(state) > 0) {
|
||||
BiConsumer<String, Throwable> errorHandler = LoadingState.getErrorHandler();
|
||||
if (errorHandler != null) {
|
||||
errorHandler.accept("New state " + state + " cannot precede old " + old, new Throwable());
|
||||
}
|
||||
}
|
||||
stateSet(state);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.diagnostic;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.diagnostic;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -25,6 +25,7 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.util.strings" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.collections" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.text.matching" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.diagnostic" exported="" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.diagnostic.StartUpMeasurer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.PropertiesUtil;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
@@ -554,6 +555,7 @@ public final class PathManager {
|
||||
Strings.class, // module 'intellij.platform.util.strings'
|
||||
FList.class, // module 'intellij.platform.util.collections'
|
||||
MinusculeMatcher.class, // module 'intellij.platform.util.text.matching'
|
||||
StartUpMeasurer.class, // module 'intellij.platform.util.diagnostic'
|
||||
com.intellij.openapi.util.SystemInfoRt.class, // module 'intellij.platform.util.rt'
|
||||
com.intellij.util.lang.UrlClassLoader.class, // module 'intellij.platform.util.classLoader'
|
||||
org.intellij.lang.annotations.Flow.class, // jetbrains-annotations-java5
|
||||
|
||||
+2
@@ -3,6 +3,7 @@
|
||||
package com.intellij.uiDesigner.snapShooter;
|
||||
|
||||
import com.intellij.designer.DesignerEditorPanelFacade;
|
||||
import com.intellij.diagnostic.StartUpMeasurer;
|
||||
import com.intellij.execution.RunConfigurationExtension;
|
||||
import com.intellij.execution.application.ApplicationConfiguration;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
@@ -80,6 +81,7 @@ public class SnapShooterConfigurationExtension extends RunConfigurationExtension
|
||||
paths.add(PathUtil.getJarPathForClass(Strings.class)); // intellij.platform.util.strings
|
||||
paths.add(PathUtil.getJarPathForClass(FList.class)); // intellij.platform.util.collections
|
||||
paths.add(PathUtil.getJarPathForClass(MinusculeMatcher.class)); // intellij.platform.util.text.matching
|
||||
paths.add(PathUtil.getJarPathForClass(StartUpMeasurer.class)); // intellij.platform.util.diagnostic
|
||||
paths.add(PathUtil.getJarPathForClass(UrlClassLoader.class)); // intellij.platform.util.classLoader
|
||||
paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // intellij.platform.core
|
||||
paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // intellij.platform.extensions
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.uiDesigner.core;
|
||||
|
||||
import com.intellij.DynamicBundle;
|
||||
import com.intellij.compiler.instrumentation.InstrumentationClassFinder;
|
||||
import com.intellij.diagnostic.StartUpMeasurer;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
@@ -92,6 +93,7 @@ public class AsmCodeGeneratorTest extends JpsBuildTestCase {
|
||||
appendPath(cp, KDeclarationContainer.class);
|
||||
appendPath(cp, NotNullProducer.class); // intellij.platform.util
|
||||
appendPath(cp, Strings.class); // intellij.platform.util.strings
|
||||
appendPath(cp, StartUpMeasurer.class); // intellij.platform.util.diagnostic
|
||||
appendPath(cp, NotNullFunction.class); // intellij.platform.util.rt
|
||||
appendPath(cp, SimpleTextAttributes.class);
|
||||
myClassFinder = new MyClassFinder(new URL[]{url}, cp.toArray(new URL[0]));
|
||||
|
||||
Reference in New Issue
Block a user