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