private static @Nullable PsiModifierList getElementToReplace(@NotNull PsiElement element) {
    final PsiElement parent = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
    if (parent instanceof PsiMethod psiMethod && !psiMethod.isConstructor()) {
      final PsiModifierList psiModifierList = psiMethod.getModifierList();
      if (psiModifierList.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
        return psiModifierList;
      }
    }
    return null;
  }
private static @Nullable PsiModifierList getElementToReplace(@NotNull PsiElement element)