当前位置: 首页>>代码示例>>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;未经允许,请勿转载。