public static boolean canInsertOverride(@NotNull PsiMethod superMethod, @NotNull PsiClass targetClass) {
    if (superMethod.isConstructor() || superMethod.hasModifierProperty(PsiModifier.STATIC)) {
      return false;
    }
    if (!PsiUtil.isAvailable(JavaFeature.ANNOTATIONS, targetClass)) {
      return false;
    }
    if (targetClass.isRecord() && superMethod.getParameterList().isEmpty()) {
      PsiMethod method = targetClass.findMethodBySignature(superMethod, false);
      if (method != null && !method.isPhysical()) return false;
    }
    if (PsiUtil.isAvailable(JavaFeature.OVERRIDE_INTERFACE, targetClass)) return true;
    PsiClass superClass = superMethod.getContainingClass();
    return superClass != null && !superClass.isInterface();
  }
public static boolean canInsertOverride(@NotNull PsiMethod superMethod, @NotNull PsiClass targetClass)