From 77b2b296410a5f712d8c22c1706a16bfd8c63786 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 3 Apr 2014 21:04:47 +0400 Subject: [PATCH] Show uninitialized descriptor's name in DeclarationDescriptor.toString() --- .../descriptors/impl/DeclarationDescriptorImpl.java | 10 ++++++++-- .../lang/descriptors/impl/MutableClassDescriptor.java | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/DeclarationDescriptorImpl.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/DeclarationDescriptorImpl.java index 0a9860370dc..a38a821918d 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/DeclarationDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/DeclarationDescriptorImpl.java @@ -53,12 +53,18 @@ public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements @Override public String toString() { + return toString(this); + } + + @NotNull + /* package */ static String toString(@NotNull DeclarationDescriptor descriptor) { try { - return DescriptorRenderer.DEBUG_TEXT.render(this) + "[" + getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "]"; + return DescriptorRenderer.DEBUG_TEXT.render(descriptor) + + "[" + descriptor.getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(descriptor)) + "]"; } catch (Throwable e) { // DescriptionRenderer may throw if this is not yet completely initialized // It is very inconvenient while debugging - return this.getClass().getName() + "@" + System.identityHashCode(this); + return descriptor.getClass().getSimpleName() + " " + descriptor.getName(); } } } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/MutableClassDescriptor.java b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/MutableClassDescriptor.java index ab9b8429f9c..06e2de8e105 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/MutableClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/descriptors/impl/MutableClassDescriptor.java @@ -368,4 +368,9 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class return builder; } + + @Override + public String toString() { + return DeclarationDescriptorImpl.toString(this); + } }