From d984f6c4b8af8e6d359f366e0908ed83866ca86e Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 30 Nov 2011 02:43:24 +0400 Subject: [PATCH] make DeclarationDescriptor.toString safe DescriptionRenderer may throw if this is not yet completely initialized It is very inconvenient while debugging --- .../jet/lang/descriptors/DeclarationDescriptorImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/DeclarationDescriptorImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/DeclarationDescriptorImpl.java index defab1eca28..e3614e3f356 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/DeclarationDescriptorImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/DeclarationDescriptorImpl.java @@ -46,6 +46,12 @@ public abstract class DeclarationDescriptorImpl extends AnnotatedImpl implements @Override public String toString() { - return DescriptorRenderer.TEXT.render(this) + "[" + getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "]"; + try { + return DescriptorRenderer.TEXT.render(this) + "[" + getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "]"; + } catch (Throwable e) { + // DescriptionRenderer may throw if this is not yet completely initialized + // It is very inconvenient while debugging + return super.toString(); + } } }