static boolean canIntroduceField(@NotNull PsiClass parentClass, @Nullable PsiType type, Editor editor) {
    if (parentClass.isInterface()) {
      String message = JavaRefactoringBundle.message("cannot.introduce.field.in.interface");
      showErrorMessage(parentClass.getProject(), editor, message);
      return false;
    }
    PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(type);
    if (aClass != null && PsiUtil.isLocalClass(aClass) && !PsiTreeUtil.isAncestor(aClass, parentClass, false)) {
      String message = JavaRefactoringBundle.message("0.is.not.visible.to.members.of.1",
                                                     RefactoringUIUtil.getDescription(aClass, false),
                                                     RefactoringUIUtil.getDescription(parentClass, false));
      showErrorMessage(aClass.getProject(), editor, StringUtil.capitalize(message));
      return false;
    }
    return true;
  }
static boolean canIntroduceField(@NotNull PsiClass parentClass, @Nullable PsiType type, Editor editor)