Show uninitialized descriptor's name in DeclarationDescriptor.toString()

This commit is contained in:
Alexander Udalov
2014-04-03 21:04:47 +04:00
parent 5606c21f89
commit 77b2b29641
2 changed files with 13 additions and 2 deletions
@@ -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();
}
}
}
@@ -368,4 +368,9 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
return builder;
}
@Override
public String toString() {
return DeclarationDescriptorImpl.toString(this);
}
}