@Override
  public void processDynamicElements(
      @NotNull PsiType qualifierType,
      PsiClass aClass,
      PsiScopeProcessor processor,
      GroovyPsiElement place,
      ResolveState state) {
    ClassHint classHint = processor.getHint(ClassHint.KEY);
    if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return;

    String nameHint = ResolveUtil.getNameHint(processor);

    Map<String, PsiClass> supers = TypesUtil.getSuperClassesWithCache(aClass);

    PsiElement grCall = place.getParent();
    if (grCall instanceof GrMethodCall) {
      PsiElement grClosure = grCall.getParent();
      if (grClosure instanceof GrClosableBlock) {
        PsiElement contentField = grClosure.getParent();
        if (contentField instanceof GrField) {
          GrField f = (GrField) contentField;
          if ("content".equals(f.getName())
              && f.hasModifierProperty(PsiModifier.STATIC)
              && f.getContainingClass() == aClass) {
            Map<String, PsiField> elements = GebUtil.getContentElements(aClass);
            for (PsiField field : elements.values()) {
              if (field.getNavigationElement() == place) {
                return; // Don't resolve variable definition.
              }
            }
          }
        }
      }
    }

    for (PsiClass psiClass : supers.values()) {
      Map<String, PsiField> contentFields = GebUtil.getContentElements(psiClass);

      if (nameHint == null) {
        for (Map.Entry<String, PsiField> entry : contentFields.entrySet()) {
          if (!processor.execute(entry.getValue(), state)) return;
        }
      } else {
        PsiField field = contentFields.get(nameHint);
        if (field != null) {
          processor.execute(field, state);
          return;
        }
      }
    }
  }
  @Override
  public void findExistingNameConflicts(
      PsiElement element, String newName, MultiMap<PsiElement, String> conflicts) {
    super.findExistingNameConflicts(element, newName, conflicts);

    GrField field = (GrField) element;
    final PsiClass containingClass = field.getContainingClass();
    if (containingClass == null) return;

    final PsiMethod getter = GroovyPropertyUtils.findGetterForField(field);
    if (getter instanceof GrAccessorMethod) {
      final PsiMethod newGetter =
          PropertyUtil.findPropertyGetter(
              containingClass, newName, field.hasModifierProperty(PsiModifier.STATIC), true);
      if (newGetter != null && !(newGetter instanceof GrAccessorMethod)) {
        conflicts.putValue(
            newGetter,
            GroovyRefactoringBundle.message(
                "implicit.getter.will.by.overriden.by.method",
                field.getName(),
                newGetter.getName()));
      }
    }
    final PsiMethod setter = GroovyPropertyUtils.findSetterForField(field);
    if (setter instanceof GrAccessorMethod) {
      final PsiMethod newSetter =
          PropertyUtil.findPropertySetter(
              containingClass, newName, field.hasModifierProperty(PsiModifier.STATIC), true);
      if (newSetter != null && !(newSetter instanceof GrAccessorMethod)) {
        conflicts.putValue(
            newSetter,
            GroovyRefactoringBundle.message(
                "implicit.setter.will.by.overriden.by.method",
                field.getName(),
                newSetter.getName()));
      }
    }
  }