void ( @NotNull DeclarationDescriptor descriptor, @NotNull ModuleDescriptor module, @NotNull Printer printer, boolean topLevel ) { if (!isFromModule(descriptor, module)) return; boolean isEnumEntry = isEnumEntry(descriptor); boolean isClassOrPackage = (descriptor instanceof ClassOrPackageFragmentDescriptor || descriptor instanceof PackageViewDescriptor) && !isEnumEntry; StringBuilder content = new StringBuilder(); if (isClassOrPackage) { Printer child = new Printer(content, printer); if (!topLevel) { child.pushIndent(); } if (descriptor instanceof ClassDescriptor klass) { appendSubDescriptors(descriptor, module, klass.getDefaultType().getMemberScope(), klass.getConstructors(), child); MemberScope staticScope = klass.getStaticScope(); if (!DescriptorUtils.getAllDescriptors(staticScope).isEmpty()) { child.println(); child.println("// Static members"); appendSubDescriptors(descriptor, module, staticScope, Collections.emptyList(), child); } } else if (descriptor instanceof PackageFragmentDescriptor) { appendSubDescriptors(descriptor, module, ((PackageFragmentDescriptor) descriptor).getMemberScope(), Collections.emptyList(), child); } else if (descriptor instanceof PackageViewDescriptor) { appendSubDescriptors(descriptor, module, getPackageScopeInModule((PackageViewDescriptor) descriptor, module), Collections.emptyList(), child); } if (!topLevel) { if (child.isEmpty() && ( descriptor instanceof PackageFragmentDescriptor || descriptor instanceof PackageViewDescriptor )) { return; } printer.println(); } } printDescriptor(descriptor, printer); if (isClassOrPackage) { if (!topLevel) { printer.printlnWithNoIndent(" {"); printer.printWithNoIndent(content); printer.println("}"); } else { printer.println(); printer.println(); printer.printWithNoIndent(StringsKt.trimStart(content, Printer.LINE_SEPARATOR.toCharArray())); } } else if (conf.checkPropertyAccessors && descriptor instanceof PropertyDescriptor propertyDescriptor) { printer.printlnWithNoIndent(); printer.pushIndent(); PropertyGetterDescriptor getter = propertyDescriptor.getGetter(); if (getter != null) { printer.println(conf.renderer.render(getter)); } PropertySetterDescriptor setter = propertyDescriptor.getSetter(); if (setter != null) { printer.println(conf.renderer.render(setter)); } printer.popIndent(); } else { printer.printlnWithNoIndent(); } if (isEnumEntry) { printer.println(); } }