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


Java ParameterTypeInferencePolicy类代码示例

本文整理汇总了Java中com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy的典型用法代码示例。如果您正苦于以下问题:Java ParameterTypeInferencePolicy类的具体用法?Java ParameterTypeInferencePolicy怎么用?Java ParameterTypeInferencePolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: inferSubstitutorFromArgs

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
public PsiSubstitutor inferSubstitutorFromArgs(@NotNull ParameterTypeInferencePolicy policy, final PsiExpression[] arguments) {
  if (myTypeArguments == null) {
    return inferTypeArguments(policy, arguments);
  }
  else {
    PsiSubstitutor incompleteSubstitutor = super.getSubstitutor();
    PsiMethod method = getElement();
    if (method != null) {
      PsiTypeParameter[] typeParams = method.getTypeParameters();
      for (int i = 0; i < myTypeArguments.length && i < typeParams.length; i++) {
        incompleteSubstitutor = incompleteSubstitutor.put(typeParams[i], myTypeArguments[i]);
      }
    }
    return incompleteSubstitutor;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:MethodCandidateInfo.java

示例2: startTopLevelInference

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@Nullable
private static InferenceSession startTopLevelInference(final PsiCall topLevelCall, final ParameterTypeInferencePolicy policy)
{
	final JavaResolveResult result = topLevelCall.resolveMethodGenerics();
	if(result instanceof MethodCandidateInfo)
	{
		final PsiMethod method = ((MethodCandidateInfo) result).getElement();
		final PsiParameter[] topLevelParameters = method.getParameterList().getParameters();
		final PsiExpressionList topLevelCallArgumentList = topLevelCall.getArgumentList();
		LOG.assertTrue(topLevelCallArgumentList != null, topLevelCall);
		final PsiExpression[] topLevelArguments = topLevelCallArgumentList.getExpressions();
		return PsiResolveHelper.ourGraphGuard.doPreventingRecursion(topLevelCall, true, new Computable<InferenceSession>()
		{
			@Override
			public InferenceSession compute()
			{
				final InferenceSession topLevelSession = new InferenceSession(method.getTypeParameters(), ((MethodCandidateInfo) result).getSiteSubstitutor(), topLevelCall.getManager(),
						topLevelCall, policy);
				topLevelSession.initExpressionConstraints(topLevelParameters, topLevelArguments, topLevelCall, method, ((MethodCandidateInfo) result).isVarargs());
				topLevelSession.infer(topLevelParameters, topLevelArguments, topLevelCall, ((MethodCandidateInfo) result).createProperties());
				return topLevelSession;
			}
		});
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:InferenceSessionContainer.java

示例3: inferTypeForMethodTypeParameter

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@Override
public PsiType inferTypeForMethodTypeParameter(@NotNull PsiTypeParameter typeParameter,
		@NotNull PsiParameter[] parameters,
		@NotNull PsiExpression[] arguments,
		@NotNull PsiSubstitutor partialSubstitutor,
		@Nullable PsiElement parent,
		@NotNull ParameterTypeInferencePolicy policy)
{
	final PsiSubstitutor substitutor;
	if(parent != null)
	{
		substitutor = inferTypeArguments(new PsiTypeParameter[]{typeParameter}, parameters, arguments, partialSubstitutor, parent, policy, PsiUtil.getLanguageLevel(parent));
	}
	else
	{
		final InferenceSession inferenceSession = new InferenceSession(new PsiTypeParameter[]{typeParameter}, partialSubstitutor, myManager, null);
		inferenceSession.initExpressionConstraints(parameters, arguments, null);
		substitutor = inferenceSession.infer();
	}
	return substitutor.substitute(typeParameter);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:PsiGraphInferenceHelper.java

示例4: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@NotNull
@Override
public PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
		@NotNull PsiParameter[] parameters,
		@NotNull PsiExpression[] arguments,
		@NotNull PsiSubstitutor partialSubstitutor,
		@NotNull PsiElement parent,
		@NotNull ParameterTypeInferencePolicy policy,
		@NotNull LanguageLevel languageLevel)
{
	if(typeParameters.length == 0)
	{
		return partialSubstitutor;
	}

	return InferenceSessionContainer.infer(typeParameters, parameters, arguments, partialSubstitutor, parent, policy);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:PsiGraphInferenceHelper.java

示例5: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
/**
 * If iterated through all candidates, should be called under {@link #ourOverloadGuard} guard so results won't be cached on the top level call
 */
@NotNull
public PsiSubstitutor inferTypeArguments(@NotNull final ParameterTypeInferencePolicy policy, @NotNull final PsiExpression[] arguments, boolean includeReturnConstraint)
{
	return computeForOverloadedCandidate(() ->
	{
		final PsiMethod method = this.getElement();
		PsiTypeParameter[] typeParameters = method.getTypeParameters();

		if(this.isRawSubstitution())
		{
			return JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createRawSubstitutor(mySubstitutor, typeParameters);
		}

		final PsiElement parent = this.getParent();
		if(parent == null)
		{
			return PsiSubstitutor.EMPTY;
		}
		Project project = method.getProject();
		JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
		return javaPsiFacade.getResolveHelper().inferTypeArguments(typeParameters, method.getParameterList().getParameters(), arguments, mySubstitutor, parent, policy, myLanguageLevel);
	}, super.getSubstitutor(), policy.isVarargsIgnored() || isVarargs(), !includeReturnConstraint);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:MethodCandidateInfo.java

示例6: inferTypeForMethodTypeParameter

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@Override
public PsiType inferTypeForMethodTypeParameter(@NotNull PsiTypeParameter typeParameter,
                                               @NotNull PsiParameter[] parameters,
                                               @NotNull PsiExpression[] arguments,
                                               @NotNull PsiSubstitutor partialSubstitutor,
                                               @Nullable PsiElement parent,
                                               @NotNull ParameterTypeInferencePolicy policy) {
  final InferenceSession inferenceSession = new InferenceSession(new PsiTypeParameter[]{typeParameter}, partialSubstitutor, myManager, parent);
  inferenceSession.initExpressionConstraints(parameters, arguments, parent, null);
  return inferenceSession.infer(parameters, arguments, parent).substitute(typeParameter);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiGraphInferenceHelper.java

示例7: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@NotNull
@Override
public PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
                                         @NotNull PsiParameter[] parameters,
                                         @NotNull PsiExpression[] arguments,
                                         @NotNull PsiSubstitutor partialSubstitutor,
                                         @NotNull PsiElement parent,
                                         @NotNull ParameterTypeInferencePolicy policy,
                                         @NotNull LanguageLevel languageLevel) {
  if (typeParameters.length == 0) return partialSubstitutor;
  final InferenceSession inferenceSession = new InferenceSession(typeParameters, partialSubstitutor, myManager, parent);
  inferenceSession.initExpressionConstraints(parameters, arguments, parent, null);
  return inferenceSession.infer(parameters, arguments, parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PsiGraphInferenceHelper.java

示例8: inferSubstitutorFromArgs

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
public PsiSubstitutor inferSubstitutorFromArgs(@NotNull ParameterTypeInferencePolicy policy, final PsiExpression[] arguments) {
  if (myTypeArguments == null) {
    return inferTypeArguments(policy, arguments, true);
  }
  else {
    return getSiteSubstitutor();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MethodCandidateInfo.java

示例9: inferTypeForMethodTypeParameter

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
/**
 * @return {@link PsiType#NULL} iff no type could be inferred
 *         null         iff the type inferred is raw
 *         inferred type otherwise
 */
PsiType inferTypeForMethodTypeParameter(@NotNull PsiTypeParameter typeParameter,
                                        @NotNull PsiParameter[] parameters,
                                        @NotNull PsiExpression[] arguments,
                                        @NotNull PsiSubstitutor partialSubstitutor,
                                        @Nullable PsiElement parent,
                                        @NotNull ParameterTypeInferencePolicy policy);
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiResolveHelper.java

示例10: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@NotNull
PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
                                  @NotNull PsiParameter[] parameters,
                                  @NotNull PsiExpression[] arguments,
                                  @NotNull PsiSubstitutor partialSubstitutor,
                                  @NotNull PsiElement parent,
                                  @NotNull ParameterTypeInferencePolicy policy);
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiResolveHelper.java

示例11: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@NotNull
PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
                                  @NotNull PsiParameter[] parameters,
                                  @NotNull PsiExpression[] arguments,
                                  @NotNull PsiSubstitutor partialSubstitutor,
                                  @NotNull PsiElement parent,
                                  @NotNull ParameterTypeInferencePolicy policy,
                                  @NotNull LanguageLevel languageLevel);
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PsiInferenceHelper.java

示例12: inferTypeForMethodTypeParameter

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
/**
 * @return {@link PsiType#NULL} iff no type could be inferred
 * null         iff the type inferred is raw
 * inferred type otherwise
 */
PsiType inferTypeForMethodTypeParameter(@NotNull PsiTypeParameter typeParameter,
		@NotNull PsiParameter[] parameters,
		@NotNull PsiExpression[] arguments,
		@NotNull PsiSubstitutor partialSubstitutor,
		@Nullable PsiElement parent,
		@NotNull ParameterTypeInferencePolicy policy);
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:PsiInferenceHelper.java

示例13: inferTypeArguments

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
@NotNull
PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
		@NotNull PsiParameter[] parameters,
		@NotNull PsiExpression[] arguments,
		@NotNull PsiSubstitutor partialSubstitutor,
		@NotNull PsiElement parent,
		@NotNull ParameterTypeInferencePolicy policy,
		@NotNull LanguageLevel languageLevel);
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:PsiInferenceHelper.java

示例14: InferenceSession

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
public InferenceSession(PsiTypeParameter[] typeParams, PsiSubstitutor siteSubstitutor, PsiManager manager, PsiElement context, ParameterTypeInferencePolicy policy)
{
	myManager = manager;
	mySiteSubstitutor = siteSubstitutor;
	myContext = context;
	myPolicy = policy;

	initBounds(typeParams);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:InferenceSession.java

示例15: inferSubstitutorFromArgs

import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy; //导入依赖的package包/类
public PsiSubstitutor inferSubstitutorFromArgs(@NotNull ParameterTypeInferencePolicy policy, final PsiExpression[] arguments)
{
	if(myTypeArguments == null)
	{
		return inferTypeArguments(policy, arguments, true);
	}
	else
	{
		return getSiteSubstitutor();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:MethodCandidateInfo.java


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