From b07780bc51a14c61bd9c0bf0a5dd2472c73a2fdc Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Mon, 21 Jan 2019 15:47:54 +0300 Subject: [PATCH] experimental annotation for debugger renderers - IDEA-144797 --- .../intellij/util/containers/MultiMap.java | 4 +++- .../org/jetbrains/annotations/Debugger.java | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 platform/util/src/org/jetbrains/annotations/Debugger.java diff --git a/platform/util/src/com/intellij/util/containers/MultiMap.java b/platform/util/src/com/intellij/util/containers/MultiMap.java index 84586a0544d2..69b1cf0a6b7f 100644 --- a/platform/util/src/com/intellij/util/containers/MultiMap.java +++ b/platform/util/src/com/intellij/util/containers/MultiMap.java @@ -1,10 +1,11 @@ -// Copyright 2000-2018 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-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. package com.intellij.util.containers; import com.intellij.util.SmartList; import gnu.trove.THashMap; import gnu.trove.TObjectHashingStrategy; +import org.jetbrains.annotations.Debugger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,6 +19,7 @@ import java.util.HashMap; * @see ConcurrentMultiMap * @author Dmitry Avdeev */ +@Debugger.Renderer(text = "\"size = \" + size()", hasChildren = "!isEmpty()", childrenArray = "entrySet().toArray()") public class MultiMap implements Serializable { public static final MultiMap EMPTY = new EmptyMap(); private static final long serialVersionUID = -2632269270151455493L; diff --git a/platform/util/src/org/jetbrains/annotations/Debugger.java b/platform/util/src/org/jetbrains/annotations/Debugger.java new file mode 100644 index 000000000000..f4418ea1c894 --- /dev/null +++ b/platform/util/src/org/jetbrains/annotations/Debugger.java @@ -0,0 +1,22 @@ +// 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. +package org.jetbrains.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * @author egor + */ +@ApiStatus.Experimental +public class Debugger { + + /** + * Advise IDEA Debugger how to render the annotated class + */ + @Target(ElementType.TYPE) + public @interface Renderer { + String text() default ""; + String childrenArray() default ""; + String hasChildren() default ""; + } +}