本文整理汇总了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)));
}
}
}
}
示例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;
}
}
示例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));
}
}
}
}
示例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);
}
示例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;
}
}
}
}
示例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);
}
});
}
示例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;
}
}
示例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);
}
}
}
}
示例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;
}
}
}
}
示例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;
}
示例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)));
}
}
}
}
示例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;
}
示例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);
}
示例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"));
}
}
}
示例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;
}