/* METHODS FOR ALL KINDS OF DESCRIPTORS */ private void appendDefinedIn( @NotNull DeclarationDescriptor descriptor, @NotNull StringBuilder builder) { if (descriptor instanceof ModuleDescriptor) { builder.append(" is a module"); return; } builder.append(" ").append(renderMessage("defined in")).append(" "); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); if (containingDeclaration != null) { FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration); builder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : renderFqName(fqName)); } }
@NotNull private String renderClassName(@NotNull ClassDescriptor klass) { if (ErrorUtils.isError(klass)) { return klass.getTypeConstructor().toString(); } if (shortNames) { List<Name> qualifiedNameElements = Lists.newArrayList(); // for nested classes qualified name should be used DeclarationDescriptor current = klass; do { if (((ClassDescriptor) current).getKind() != ClassKind.CLASS_OBJECT) { qualifiedNameElements.add(current.getName()); } current = current.getContainingDeclaration(); } while (current instanceof ClassDescriptor); Collections.reverse(qualifiedNameElements); return renderFqName(qualifiedNameElements); } return renderFqName(DescriptorUtils.getFQName(klass)); }