private void renderVisibility(@NotNull Visibility visibility, @NotNull StringBuilder builder) { if (!modifiers.contains(Modifier.VISIBILITY)) return; if (normalizedVisibilities) { visibility = visibility.normalize(); } if (!showInternalKeyword && visibility == Visibilities.INTERNAL) return; builder.append(renderKeyword(visibility.toString())).append(" "); }
@Nullable private static Visibility computeVisibilityToInherit( @NotNull CallableMemberDescriptor memberDescriptor) { Collection<? extends CallableMemberDescriptor> overriddenDescriptors = memberDescriptor.getOverriddenDescriptors(); Visibility maxVisibility = findMaxVisibility(overriddenDescriptors); if (maxVisibility == null) { return null; } if (memberDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { for (CallableMemberDescriptor overridden : overriddenDescriptors) { // An implementation (a non-abstract overridden member) of a fake override should have the // maximum possible visibility if (overridden.getModality() != Modality.ABSTRACT && !overridden.getVisibility().equals(maxVisibility)) { return null; } } return maxVisibility; } return maxVisibility.normalize(); }