private boolean isUsedInInitializer(PsiElement usage) {
    PsiElement parent = usage.getParent();
    while (!myAnonOrLocalClass.equals(parent)) {
      if (parent instanceof PsiExpressionList expressionList) {
        if (myAnonOrLocalClass.equals(expressionList.getParent())) {
          return true;
        }
      } else if ((parent instanceof PsiClassInitializer || parent instanceof PsiField || 
                  parent instanceof PsiMethod method && method.isConstructor())
                 && myAnonOrLocalClass.equals(((PsiMember)parent).getContainingClass())) {
        //class and field initializers will be moved to constructor to be generated
        return true;
      }
      parent = parent.getParent();
    }
    return false;
  }
private boolean isUsedInInitializer(PsiElement usage)