public void delegatesTo(@Nullable PsiElement elem, GdslMembersHolderConsumer consumer) {
    if (elem instanceof PsiClass clazz) {
      final NonCodeMembersHolder holder = new NonCodeMembersHolder();

      if (clazz instanceof GrTypeDefinition context) {
        final PsiClassType type = JavaPsiFacade.getElementFactory(consumer.getProject()).createType(clazz);
        final ResolverProcessor processor = CompletionProcessor.createPropertyCompletionProcessor(clazz);
        ResolveUtil.processAllDeclarations(type, processor, ResolveState.initial(), context);
        for (GroovyResolveResult result : processor.getCandidates()) {
          final PsiElement element = result.getElement();
          if (element instanceof PsiMethod && !((PsiMethod)element).isConstructor() || element instanceof PsiField) {
            holder.addDeclaration(element);
          }
        }
      }
      else {
        for (PsiMethod method : clazz.getAllMethods()) {
          if (!method.isConstructor()) holder.addDeclaration(method);
        }
        for (PsiField field : clazz.getAllFields()) {
          holder.addDeclaration(field);
        }
      }
      consumer.addMemberHolder(holder);
    }
    else if (elem instanceof GrExpression expr) {
      final PsiType type = expr.getType();
      if (type instanceof PsiClassType ctype) {
        delegatesTo(ctype.resolve(), consumer);
      }
    }
  }
public void delegatesTo(@Nullable PsiElement elem, GdslMembersHolderConsumer consumer)