private static boolean hasCompatibleVisibility(PsiMethod method, boolean isSuper, final String modifier) {
      return switch (modifier) {
        case PsiModifier.PRIVATE -> false;
        case PsiModifier.PACKAGE_LOCAL ->
          !isSuper || !(method.hasModifierProperty(PsiModifier.PUBLIC) || method.hasModifierProperty(PsiModifier.PROTECTED));
        case PsiModifier.PROTECTED -> isSuper ? !method.hasModifierProperty(PsiModifier.PUBLIC)
                                              : method.hasModifierProperty(PsiModifier.PROTECTED) ||
                                                method.hasModifierProperty(PsiModifier.PUBLIC);
        case PsiModifier.PUBLIC -> isSuper || method.hasModifierProperty(PsiModifier.PUBLIC);
        default -> throw new IllegalStateException("Unexpected value: " + modifier);
      };
    }
private static boolean hasCompatibleVisibility(PsiMethod method, boolean isSuper, final String modifier)