private static Modality getModalitySafe(@NotNull MemberDescriptor descriptor) {
        try {
            return descriptor.getModality();
        }
        catch (InvalidModuleException ex) {
            return Modality.FINAL;
        }
    }
private static Modality getModalitySafe(@NotNull MemberDescriptor descriptor)