當前位置: 首頁>>代碼示例>>Java>>正文


Java MethodCandidatesProcessor類代碼示例

本文整理匯總了Java中com.intellij.psi.scope.processor.MethodCandidatesProcessor的典型用法代碼示例。如果您正苦於以下問題:Java MethodCandidatesProcessor類的具體用法?Java MethodCandidatesProcessor怎麽用?Java MethodCandidatesProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MethodCandidatesProcessor類屬於com.intellij.psi.scope.processor包,在下文中一共展示了MethodCandidatesProcessor類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getReferencedMethodCandidates

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@NotNull
@Override
public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression expr,
                                                     boolean dummyImplicitConstructor,
                                                     final boolean checkVarargs) {
  PsiFile containingFile = expr.getContainingFile();
  final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(expr, containingFile) {
    @Override
    protected boolean acceptVarargs() {
      return checkVarargs;
    }
  };
  try {
    PsiScopesUtil.setupAndRunProcessor(processor, expr, dummyImplicitConstructor);
  }
  catch (MethodProcessorSetupFailedException e) {
    return CandidateInfo.EMPTY_ARRAY;
  }
  return processor.getCandidates();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:PsiResolveHelperImpl.java

示例2: getReferencedMethodCandidates

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@NotNull
@Override
public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression expr, boolean dummyImplicitConstructor, final boolean checkVarargs)
{
    PsiFile containingFile = expr.getContainingFile();
    final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(expr, containingFile)
    {
        @Override
        protected boolean acceptVarargs()
        {
            return checkVarargs;
        }
    };
    try
    {
        PsiScopesUtil.setupAndRunProcessor(processor, expr, dummyImplicitConstructor);
    }
    catch(MethodProcessorSetupFailedException e)
    {
        return CandidateInfo.EMPTY_ARRAY;
    }
    return processor.getCandidates();
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:24,代碼來源:PsiResolveHelperImpl.java

示例3: getCandidates

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
private static CandidateInfo[] getCandidates(PsiCallExpression call)
{
    final MethodCandidatesProcessor processor = new MethodResolverProcessor(call, call.getContainingFile(), new PsiConflictResolver[0])
    {
        @Override
        protected boolean acceptVarargs()
        {
            return false;
        }
    };

    try
    {
        PsiScopesUtil.setupAndRunProcessor(processor, call, true);
    }
    catch(MethodProcessorSetupFailedException e)
    {
        return CandidateInfo.EMPTY_ARRAY;
    }
    final List<CandidateInfo> results = processor.getResults();
    return results.toArray(new CandidateInfo[results.size()]);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:23,代碼來源:MethodParameterInfoHandler.java

示例4: getResults

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@NotNull
protected JavaResolveResult[] getResults(@NotNull PsiCallExpression contextCall, final int exprIdx) throws MethodProcessorSetupFailedException {
  PsiFile containingFile = contextCall.getContainingFile();
  final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(contextCall, containingFile);
  //can't call resolve() since it obtains full substitution, that may result in infinite recursion
  PsiScopesUtil.setupAndRunProcessor(processor, contextCall, false);
  return processor.getResult();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ProcessCandidateParameterTypeInferencePolicy.java

示例5: getReferencedMethodCandidates

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@Override
@NotNull
public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression expr, boolean dummyImplicitConstructor) {
  PsiFile containingFile = expr.getContainingFile();
  final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(expr, containingFile);
  try {
    PsiScopesUtil.setupAndRunProcessor(processor, expr, dummyImplicitConstructor);
  }
  catch (MethodProcessorSetupFailedException e) {
    return CandidateInfo.EMPTY_ARRAY;
  }
  return processor.getCandidates();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:14,代碼來源:PsiResolveHelperImpl.java

示例6: getResults

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@NotNull
protected JavaResolveResult[] getResults(@NotNull PsiCallExpression contextCall, final int exprIdx) throws MethodProcessorSetupFailedException
{
    PsiFile containingFile = contextCall.getContainingFile();
    final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(contextCall, containingFile);
    //can't call resolve() since it obtains full substitution, that may result in infinite recursion
    PsiScopesUtil.setupAndRunProcessor(processor, contextCall, false);
    return processor.getResult();
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:10,代碼來源:ProcessCandidateParameterTypeInferencePolicy.java

示例7: findConstructorStaticFactory

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@Nullable
private static PsiMethod findConstructorStaticFactory(final PsiClass containingClass, PsiNewExpression newExpression) {
  final PsiExpressionList argumentList = newExpression.getArgumentList();
  if (argumentList == null) return null;

  final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(newExpression);
  final List<CandidateInfo> conflicts = new ArrayList<CandidateInfo>();
  PsiMethod[] constructors = containingClass.getConstructors();
  if (constructors.length == 0) {
    //default constructor
    constructors = new PsiMethod[] {null};
  }

  final PsiConflictResolver[] conflictResolvers = {new JavaMethodsConflictResolver(argumentList, languageLevel)};
  final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(argumentList, argumentList.getContainingFile(), conflictResolvers, conflicts) {
    @Override
    protected boolean isAccepted(PsiMethod candidate) {
      return true;
    }

    @Override
    protected PsiClass getContainingClass(PsiMethod method) {
      return containingClass;
    }

    @Override
    protected boolean acceptVarargs() {
      return true;
    }
  };
  processor.setArgumentList(argumentList);

  for (PsiMethod constructor : constructors) {
    final PsiTypeParameter[] params = getAllTypeParams(constructor, containingClass);
    final PsiMethod staticFactory = generateStaticFactory(constructor, containingClass, params, newExpression.getClassReference());
    if (staticFactory != null) {
      processor.add(staticFactory, PsiSubstitutor.EMPTY);
    }
  }

  final JavaResolveResult[] result = processor.getResult();
  return result.length == 1 ? (PsiMethod)result[0].getElement() : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:PsiDiamondTypeImpl.java

示例8: collectStaticFactories

import com.intellij.psi.scope.processor.MethodCandidatesProcessor; //導入依賴的package包/類
@Nullable
public static JavaResolveResult[] collectStaticFactories(PsiNewExpression newExpression, final PsiConflictResolver... conflictResolvers)
{
    PsiExpressionList argumentList = newExpression.getArgumentList();
    if(argumentList == null)
    {
        return null;
    }

    final PsiClass psiClass = findClass(newExpression);
    if(psiClass == null)
    {
        //should not happens: unresolved class reference would be first and inference won't start
        return null;
    }

    final List<CandidateInfo> candidates = new ArrayList<CandidateInfo>();
    PsiMethod[] constructors = psiClass.getConstructors();
    if(constructors.length == 0)
    {
        //default constructor
        constructors = new PsiMethod[]{null};
    }

    final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(argumentList, argumentList.getContainingFile(), conflictResolvers, candidates)
    {
        @Override
        protected boolean isAccepted(PsiMethod candidate)
        {
            return true;
        }

        @Override
        protected PsiClass getContainingClass(PsiMethod method)
        {
            return psiClass;
        }

        @Override
        protected boolean acceptVarargs()
        {
            return true;
        }
    };
    processor.setArgumentList(argumentList);

    for(PsiMethod constructor : constructors)
    {
        final PsiTypeParameter[] params = getAllTypeParams(constructor, psiClass);
        final PsiMethod staticFactory = generateStaticFactory(constructor, psiClass, params, newExpression.getClassReference());
        if(staticFactory != null)
        {
            processor.add(staticFactory, PsiSubstitutor.EMPTY);
        }
    }

    return processor.getResult();
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:59,代碼來源:PsiDiamondTypeImpl.java


注:本文中的com.intellij.psi.scope.processor.MethodCandidatesProcessor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。