private void processMethods(final MethodResolverProcessor methodResolver) {
    GrReferenceResolveUtil.resolveImpl(methodResolver, this);
    if (methodResolver.hasApplicableCandidates()) {
      return;
    }

    // Search in ClosureMissingMethodContributor
    if (!isQualified() && getContext() instanceof GrMethodCall) {
      for (PsiElement e = this.getContext(); e != null; e = e.getContext()) {
        if (e instanceof GrClosableBlock) {
          ResolveState state = ResolveState.initial().put(ResolverProcessor.RESOLVE_CONTEXT, e);
          for (ClosureMissingMethodContributor contributor :
              ClosureMissingMethodContributor.EP_NAME.getExtensions()) {
            if (!contributor.processMembers((GrClosableBlock) e, methodResolver, this, state)) {
              return;
            }
          }
        }
      }
    }
  }
Exemple #2
0
  private void getVariantsImpl() {
    GrExpression qualifier = myRefExpr.getQualifierExpression();
    if (qualifier == null) {
      ResolveUtil.treeWalkUp(myRefExpr, myProcessor, true);

      for (PsiElement e = myRefExpr.getParent(); e != null; e = e.getParent()) {
        if (e instanceof GrClosableBlock) {
          ResolveState state = ResolveState.initial().put(ClassHint.RESOLVE_CONTEXT, e);
          for (ClosureMissingMethodContributor contributor :
              ClosureMissingMethodContributor.EP_NAME.getExtensions()) {
            contributor.processMembers((GrClosableBlock) e, myProcessor, myRefExpr, state);
          }
        }
      }

      GrExpression runtimeQualifier = PsiImplUtil.getRuntimeQualifier(myRefExpr);
      if (runtimeQualifier != null) {
        getVariantsFromQualifier(runtimeQualifier);
      }

      getBindings();
    } else {
      if (myRefExpr.getDotTokenType() != GroovyTokenTypes.mSPREAD_DOT) {
        getVariantsFromQualifier(qualifier);

        if (qualifier instanceof GrReferenceExpression
            && ("class".equals(((GrReferenceExpression) qualifier).getReferenceName())
                || PsiUtil.isThisReference(qualifier) && !PsiUtil.isInstanceThisRef(qualifier))) {
          processIfJavaLangClass(qualifier.getType());
        }
      } else {
        getVariantsFromQualifierForSpreadOperator(qualifier);
      }
    }
    ResolveUtil.processCategoryMembers(myRefExpr, myProcessor, ResolveState.initial());
  }