当前位置: 首页>>代码示例>>Java>>正文


Java MethodCandidateInfo.CurrentCandidateProperties方法代码示例

本文整理汇总了Java中com.intellij.psi.infos.MethodCandidateInfo.CurrentCandidateProperties方法的典型用法代码示例。如果您正苦于以下问题:Java MethodCandidateInfo.CurrentCandidateProperties方法的具体用法?Java MethodCandidateInfo.CurrentCandidateProperties怎么用?Java MethodCandidateInfo.CurrentCandidateProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.infos.MethodCandidateInfo的用法示例。


在下文中一共展示了MethodCandidateInfo.CurrentCandidateProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initExpressionConstraints

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public void initExpressionConstraints(PsiParameter[] parameters,
                                      PsiExpression[] args,
                                      PsiElement parent,
                                      PsiMethod method,
                                      boolean varargs) {
  final MethodCandidateInfo.CurrentCandidateProperties currentProperties = getCurrentProperties(parent);
  if (method == null) {
    if (currentProperties != null) {
      method = currentProperties.getMethod();
    }
  }
  if (method != null) {
    initThrowsConstraints(method);
  }
  if (parameters.length > 0) {
    for (int i = 0; i < args.length; i++) {
      if (args[i] != null && isPertinentToApplicability(args[i], method)) {
        PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
        addConstraint(new ExpressionCompatibilityConstraint(args[i], substituteWithInferenceVariables(parameterType)));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:InferenceSession.java

示例2: getCalledMethod

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private static PsiMethod getCalledMethod(PsiCall arg) {
  final PsiExpressionList argumentList = arg.getArgumentList();
  if (argumentList == null) {
    return null;
  }

  MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
  if (properties != null) {
    return properties.getMethod();
  }
  final JavaResolveResult resolveResult = getMethodResult(arg);
  if (resolveResult instanceof MethodCandidateInfo) {
    return (PsiMethod)resolveResult.getElement();
  }
  else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:InferenceSession.java

示例3: collectAdditionalConstraints

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private void collectAdditionalConstraints(final Set<ConstraintFormula> additionalConstraints,
                                          final PsiCall callExpression) {
  PsiExpressionList argumentList = callExpression.getArgumentList();
  if (argumentList != null) {
    final JavaResolveResult result = getMethodResult(callExpression);
    MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
    final PsiMethod method = result instanceof MethodCandidateInfo ? ((MethodCandidateInfo)result).getElement() : properties != null ? properties.getMethod() : null;
    if (method != null) {
      final PsiExpression[] newArgs = argumentList.getExpressions();
      final PsiParameter[] newParams = method.getParameterList().getParameters();
      if (newParams.length > 0) {
        collectAdditionalConstraints(newParams, newArgs, method, chooseSiteSubstitutor(properties, result, method), additionalConstraints, chooseVarargsMode(properties, result));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InferenceSession.java

示例4: getMethodResult

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private static JavaResolveResult getMethodResult(final PsiCall callExpression) {
  final PsiExpressionList argumentList = callExpression.getArgumentList();

  final PsiLambdaExpression expression = PsiTreeUtil.getParentOfType(argumentList, PsiLambdaExpression.class);
  final Computable<JavaResolveResult> computableResolve = new Computable<JavaResolveResult>() {
    @Override
    public JavaResolveResult compute() {
      return getResolveResult(callExpression, argumentList);
    }
  };
  MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
  return properties != null ? null :
         expression == null || !PsiResolveHelper.ourGraphGuard.currentStack().contains(expression)
         ? computableResolve.compute()
         : PsiResolveHelper.ourGraphGuard.doPreventingRecursion(expression, false, computableResolve);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InferenceSession.java

示例5: TypeParamsChecker

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public TypeParamsChecker(PsiElement expression, PsiClass aClass) {
  myClass = aClass;
  PsiElement parent = expression != null ? expression.getParent() : null;
  while (parent instanceof PsiParenthesizedExpression) {
    parent = parent.getParent();
  }
  if (parent instanceof PsiExpressionList) {
    final PsiElement gParent = parent.getParent();
    if (gParent instanceof PsiCall) {
      final MethodCandidateInfo.CurrentCandidateProperties pair = MethodCandidateInfo.getCurrentMethod(parent);
      myMethod = pair != null ? pair.getMethod() : null;
      if (myMethod == null) {
        myMethod = ((PsiCall)gParent).resolveMethod();
      }
      if (myMethod != null && PsiTreeUtil.isAncestor(myMethod, expression, false)) {
        myMethod = null;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LambdaUtil.java

示例6: resolveConflict

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
@Override
public final CandidateInfo resolveConflict(@NotNull final List<CandidateInfo> conflicts)
{
	final MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(myArgumentsList);
	if(properties != null && properties.isApplicabilityCheck())
	{
		final PsiMethod method = properties.getMethod();
		LOG.error("Recursive conflict resolution for:" + method + "; " +
				myArgumentsList.getText() + "; " +
				"file=" + (method == null ? "<unknown>" : method.getContainingFile()));
	}
	return MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(myArgumentsList, false, new Computable<CandidateInfo>()
	{
		@Override
		public CandidateInfo compute()
		{
			return guardedOverloadResolution(conflicts);
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:JavaMethodsConflictResolver.java

示例7: getCalledMethod

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public static PsiMethod getCalledMethod(PsiCall arg)
{
	final PsiExpressionList argumentList = arg.getArgumentList();
	if(argumentList == null)
	{
		return null;
	}

	MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
	if(properties != null)
	{
		return properties.getMethod();
	}
	final JavaResolveResult resolveResult = getResolveResult(arg);
	if(resolveResult instanceof MethodCandidateInfo)
	{
		return (PsiMethod) resolveResult.getElement();
	}
	else
	{
		return null;
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:InferenceSession.java

示例8: collectAdditionalConstraints

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private void collectAdditionalConstraints(final Set<ConstraintFormula> additionalConstraints,
		final Set<ConstraintFormula> ignoredConstraints,
		final PsiCall callExpression,
		PsiSubstitutor initialSubstitutor)
{
	PsiExpressionList argumentList = callExpression.getArgumentList();
	if(argumentList != null)
	{
		MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(argumentList);
		final JavaResolveResult result = properties != null ? null : getResolveResult(callExpression);
		final PsiMethod method = properties != null ? properties.getMethod() : result instanceof MethodCandidateInfo ? ((MethodCandidateInfo) result).getElement() : null;
		if(method != null)
		{
			final PsiExpression[] newArgs = argumentList.getExpressions();
			final PsiParameter[] newParams = method.getParameterList().getParameters();
			if(newParams.length > 0)
			{
				collectAdditionalConstraints(newParams, newArgs, method, chooseSiteSubstitutor(properties, result, method), additionalConstraints, ignoredConstraints, chooseVarargsMode
						(properties, result), initialSubstitutor);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:InferenceSession.java

示例9: TypeParamsChecker

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public TypeParamsChecker(PsiElement expression, PsiClass aClass)
{
	myClass = aClass;
	PsiElement parent = expression != null ? expression.getParent() : null;
	while(parent instanceof PsiParenthesizedExpression)
	{
		parent = parent.getParent();
	}
	if(parent instanceof PsiExpressionList)
	{
		final PsiElement gParent = parent.getParent();
		if(gParent instanceof PsiCall)
		{
			final MethodCandidateInfo.CurrentCandidateProperties pair = MethodCandidateInfo.getCurrentMethod(parent);
			myMethod = pair != null ? pair.getMethod() : null;
			if(myMethod == null)
			{
				myMethod = ((PsiCall) gParent).resolveMethod();
			}
			if(myMethod != null && PsiTreeUtil.isAncestor(myMethod, expression, false))
			{
				myMethod = null;
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:LambdaUtil.java

示例10: isPolyExpression

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public static boolean isPolyExpression(final PsiExpression expression) {
  if (expression instanceof PsiFunctionalExpression) {
    return true;
  } 
  else if (expression instanceof PsiParenthesizedExpression) {
    return isPolyExpression(((PsiParenthesizedExpression)expression).getExpression());
  }
  else if (expression instanceof PsiNewExpression) {
    final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)expression).getClassOrAnonymousClassReference();
    if (classReference != null) {
      final PsiReferenceParameterList parameterList = classReference.getParameterList();
      if (parameterList != null) {
        final PsiTypeElement[] typeElements = parameterList.getTypeParameterElements();
        if (typeElements.length == 1 && typeElements[0].getType() instanceof PsiDiamondType) {
          return isInAssignmentOrInvocationContext(expression);
        }
      }
    }
  } else if (expression instanceof PsiMethodCallExpression) {
    final MethodCandidateInfo.CurrentCandidateProperties candidateProperties = MethodCandidateInfo.getCurrentMethod(((PsiMethodCallExpression)expression).getArgumentList());
    return isMethodCallPolyExpression(expression, candidateProperties != null ? candidateProperties.getMethod() : ((PsiMethodCallExpression)expression).resolveMethod());
  }
  else if (expression instanceof PsiConditionalExpression) {
    final ConditionalKind conditionalKind = isBooleanOrNumeric(expression);
    if (conditionalKind == null) {
      return isInAssignmentOrInvocationContext(expression);
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:PsiPolyExpressionUtil.java

示例11: initExpressionConstraints

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public void initExpressionConstraints(PsiParameter[] parameters, PsiExpression[] args, PsiElement parent, PsiMethod method, boolean varargs)
{
	final MethodCandidateInfo.CurrentCandidateProperties currentProperties = getCurrentProperties(parent);
	if(method == null)
	{
		if(currentProperties != null)
		{
			method = currentProperties.getMethod();
		}
	}
	if(method != null)
	{
		initThrowsConstraints(method);
	}
	if(parameters.length > 0)
	{
		for(int i = 0; i < args.length; i++)
		{
			//don't infer anything if number of parameters differ and method is not vararg
			if(!varargs && i >= parameters.length)
			{
				continue;
			}

			if(args[i] != null && isPertinentToApplicability(args[i], method))
			{
				PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
				addConstraint(new ExpressionCompatibilityConstraint(args[i], substituteWithInferenceVariables(parameterType)));
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:33,代码来源:InferenceSession.java

示例12: getCurrentProperties

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private static MethodCandidateInfo.CurrentCandidateProperties getCurrentProperties(PsiElement parent)
{
	if(parent instanceof PsiCall)
	{
		return MethodCandidateInfo.getCurrentMethod(((PsiCall) parent).getArgumentList());
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:InferenceSession.java

示例13: collectAdditionalAndInfer

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
public PsiSubstitutor collectAdditionalAndInfer(@NotNull PsiParameter[] parameters,
		@NotNull PsiExpression[] args,
		@NotNull MethodCandidateInfo.CurrentCandidateProperties properties,
		@NotNull PsiSubstitutor psiSubstitutor)
{
	return performGuardedInference(parameters, args, myContext, properties, psiSubstitutor);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:InferenceSession.java

示例14: performGuardedInference

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
@NotNull
private PsiSubstitutor performGuardedInference(@Nullable PsiParameter[] parameters,
		@Nullable PsiExpression[] args,
		@Nullable PsiElement parent,
		@Nullable MethodCandidateInfo.CurrentCandidateProperties properties,
		@NotNull PsiSubstitutor initialSubstitutor)
{
	try
	{
		doInfer(parameters, args, parent, properties, initialSubstitutor);
		return prepareSubstitution();
	}
	finally
	{
		for(ConstraintFormula formula : myConstraintsCopy)
		{
			if(formula instanceof InputOutputConstraintFormula)
			{
				LambdaUtil.getFunctionalTypeMap().remove(((InputOutputConstraintFormula) formula).getExpression());
			}
		}

		if(properties != null && myErrorMessages != null)
		{
			properties.getInfo().setInferenceError(StringUtil.join(myErrorMessages, "\n"));
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:29,代码来源:InferenceSession.java

示例15: getInputInferenceVariablesFromTopLevelFunctionalExpressions

import com.intellij.psi.infos.MethodCandidateInfo; //导入方法依赖的package包/类
private Collection<InferenceVariable> getInputInferenceVariablesFromTopLevelFunctionalExpressions(PsiExpression[] args, MethodCandidateInfo.CurrentCandidateProperties properties)
{
	if(args == null)
	{
		return Collections.emptyList();
	}
	final PsiMethod method = properties.getMethod();
	final PsiParameter[] parameters = method.getParameterList().getParameters();
	if (parameters.length == 0)
	{
		return Collections.emptyList();
	}
	final HashSet<InferenceVariable> dependencies = new HashSet<>();
	for(int i = 0; i < args.length; i++)
	{
		PsiExpression arg = args[i];
		if(arg instanceof PsiLambdaExpression && !((PsiLambdaExpression) arg).hasFormalParameterTypes() || arg instanceof PsiMethodReferenceExpression && !((PsiMethodReferenceExpression) arg)
				.isExact())
		{
			final PsiSubstitutor nestedSubstitutor = myInferenceSessionContainer.findNestedSubstitutor(arg, myInferenceSubstitution);
			final PsiType parameterType = nestedSubstitutor.substitute(getParameterType(parameters, i, mySiteSubstitutor, properties.isVarargs()));
			final PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(parameterType);
			final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(result);
			if(interfaceMethod != null)
			{
				final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, result);
				for(PsiParameter parameter : interfaceMethod.getParameterList().getParameters())
				{
					collectDependencies(substitutor.substitute(parameter.getType()), dependencies);
				}
			}
		}
	}
	return dependencies;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:36,代码来源:InferenceSession.java


注:本文中的com.intellij.psi.infos.MethodCandidateInfo.CurrentCandidateProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。