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


Java MethodSignature.getParameterTypes方法代码示例

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


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

示例1: checkReturnTypeApplicable

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private static boolean checkReturnTypeApplicable(PsiClassType.ClassResolveResult resolveResult, final PsiClass aClass) {
  final MethodSignature methodSignature = LambdaUtil.getFunction(aClass);
  if (methodSignature == null) return false;

  for (PsiTypeParameter parameter : aClass.getTypeParameters()) {
    if (parameter.getExtendsListTypes().length == 0) continue;
    final PsiType substitution = resolveResult.getSubstitutor().substitute(parameter);
    if (substitution instanceof PsiWildcardType && !((PsiWildcardType)substitution).isBounded()) {
      boolean depends = false;
      for (PsiType paramType : methodSignature.getParameterTypes()) {
        if (LambdaUtil.depends(paramType, new LambdaUtil.TypeParamsChecker((PsiMethod)null, aClass) {
          @Override
          public boolean startedInference() {
            return true;
          }
        }, parameter)) {
          depends = true;
          break;
        }
      }
      if (!depends) return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LambdaHighlightingUtil.java

示例2: isConvertible

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
@Override
public Boolean isConvertible(@NotNull PsiType ltype, @NotNull PsiType rtype, @NotNull final GroovyPsiElement context) {
  if (rtype instanceof GrClosureType &&
      ltype instanceof PsiClassType &&
      isSamConversionAllowed(context) &&
      !TypesUtil.isClassType(ltype, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) {
    MethodSignature signature = findSAMSignature(ltype);
    if (signature != null) {
      final PsiType[] samParameterTypes = signature.getParameterTypes();

      GrSignature closureSignature = ((GrClosureType)rtype).getSignature();

      boolean raw = ((PsiClassType)ltype).isRaw();
      if (raw) return true;

      if (GrClosureSignatureUtil.isSignatureApplicable(closureSignature, samParameterTypes, context)) {
        return true;
      }
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClosureToSamConverter.java

示例3: checkReturnTypeApplicable

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private static boolean checkReturnTypeApplicable(PsiClassType.ClassResolveResult resolveResult, final PsiClass aClass) {
  final MethodSignature methodSignature = LambdaUtil.getFunction(aClass);
  if (methodSignature == null) return false;

  for (PsiTypeParameter parameter : aClass.getTypeParameters()) {
    if (parameter.getExtendsListTypes().length == 0) continue;
    boolean depends = false;
    final PsiType substitution = resolveResult.getSubstitutor().substitute(parameter);
    if (substitution instanceof PsiWildcardType && !((PsiWildcardType)substitution).isBounded()) {
      for (PsiType paramType : methodSignature.getParameterTypes()) {
        if (LambdaUtil.depends(paramType, new LambdaUtil.TypeParamsChecker((PsiMethod)null, aClass) {
          @Override
          public boolean startedInference() {
            return true;
          }
        }, parameter)) {
          depends = true;
          break;
        }
      }
      if (!depends) return true;
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:LambdaHighlightingUtil.java

示例4: isConvertible

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
@Override
public Boolean isConvertible(@NotNull PsiType ltype, @NotNull PsiType rtype, @NotNull final GroovyPsiElement context) {
  if (rtype instanceof GrClosureType && ltype instanceof PsiClassType && GroovyConfigUtils.getInstance().isVersionAtLeast(context, GroovyConfigUtils.GROOVY2_2)) {
    PsiClassType.ClassResolveResult resolveResult = ((PsiClassType)ltype).resolveGenerics();
    final PsiClass resolved = resolveResult.getElement();
    if (resolved != null) {
      final MethodSignature signature = findSingleAbstractMethodClass(resolved, resolveResult.getSubstitutor());
      if (signature != null) {

        final PsiType[] samParameterTypes = signature.getParameterTypes();

        GrSignature closureSignature = ((GrClosureType)rtype).getSignature();
        if (GrClosureSignatureUtil.isSignatureApplicable(closureSignature, samParameterTypes, context)) {
          return true;
        }
      }
    }
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ClosureToSamConverter.java

示例5: MethodReferenceConflictResolver

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private MethodReferenceConflictResolver(PsiMethodReferenceExpressionImpl referenceExpression,
                                        PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
                                        @Nullable MethodSignature signature, boolean varArgs) {
  super(referenceExpression, signature != null ? signature.getParameterTypes() : PsiType.EMPTY_ARRAY, PsiUtil.getLanguageLevel(referenceExpression));
  myReferenceExpression = referenceExpression;
  myQualifierResolveResult = qualifierResolveResult;
  myFunctionalMethodVarArgs = varArgs;
  mySignature = signature;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MethodReferenceResolver.java

示例6: arrayCreationSignature

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private static boolean arrayCreationSignature(MethodSignature signature) {
  final PsiType[] parameterTypes = signature.getParameterTypes();
  if (parameterTypes.length == 1 && parameterTypes[0] != null && TypeConversionUtil.isAssignable(PsiType.INT, parameterTypes[0])) {
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MethodReferenceResolver.java

示例7: getSignaturePresentation

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
public static String getSignaturePresentation(MethodSignature signature) {
  StringBuilder builder = new StringBuilder();
  builder.append(signature.getName()).append('(');
  PsiType[] types = signature.getParameterTypes();
  for (PsiType type : types) {
    builder.append(type.getPresentableText()).append(", ");
  }
  if (types.length > 0) builder.delete(builder.length() - 2, builder.length());
  builder.append(")");
  return builder.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GroovyPresentationUtil.java

示例8: createSignature

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
public static GrClosureSignature createSignature(MethodSignature signature) {
  final PsiType[] types = signature.getParameterTypes();
  GrClosureParameter[] parameters = new GrClosureParameter[types.length];
  ContainerUtil.map(types, new Function<PsiType, GrClosureParameter>() {
    @Override
    public GrClosureParameter fun(PsiType type) {
      return new GrImmediateClosureParameterImpl(type, null, false, null);
    }
  }, parameters);
  return new GrImmediateClosureSignatureImpl(parameters, null, false, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GrClosureSignatureUtil.java

示例9: inferTypeArgumentsFromInterfaceMethod

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private PsiSubstitutor inferTypeArgumentsFromInterfaceMethod(@Nullable MethodSignature signature,
                                                             @Nullable PsiType interfaceMethodReturnType,
                                                             PsiMethod method,
                                                             PsiSubstitutor substitutor,
                                                             LanguageLevel languageLevel) {
  if (signature == null) return PsiSubstitutor.EMPTY;
  PsiType[] types = method.getSignature(PsiUtil.isRawSubstitutor(method, substitutor) ? PsiSubstitutor.EMPTY : substitutor).getParameterTypes();
  PsiType[] rightTypes = signature.getParameterTypes();
  if (!method.isVarArgs() || types.length == 0) {
    if (types.length < rightTypes.length) {
      return getSubstitutor(rightTypes[0]);
    } else if (types.length > rightTypes.length) {
      return getSubstitutor(types[0]);
    }
  } else {
    if (rightTypes.length != types.length || rightTypes[rightTypes.length - 1].getArrayDimensions() != types[types.length-1].getArrayDimensions()) {
      types[types.length - 1] = ((PsiArrayType)types[types.length - 1]).getComponentType();
      int min = Math.min(types.length, rightTypes.length);
      types = Arrays.copyOf(types, min);
      rightTypes = Arrays.copyOf(rightTypes, min);
    }
  }

  for (int i = 0; i < rightTypes.length; i++) {
    rightTypes[i] = GenericsUtil.eliminateWildcards(rightTypes[i]);
  }
  final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(getProject()).getResolveHelper();
  PsiSubstitutor psiSubstitutor = resolveHelper.inferTypeArguments(method.getTypeParameters(), types, rightTypes, languageLevel);
  psiSubstitutor = psiSubstitutor.putAll(substitutor);
  if (method.isConstructor()) {
    psiSubstitutor = psiSubstitutor.putAll(resolveHelper.inferTypeArguments(method.getContainingClass().getTypeParameters(), types, rightTypes, languageLevel));
  }

  return LambdaUtil.inferFromReturnType(method.getTypeParameters(),
                                        psiSubstitutor.substitute(method.getReturnType()),
                                        interfaceMethodReturnType,
                                        psiSubstitutor,
                                        languageLevel, getProject());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:PsiMethodReferenceExpressionImpl.java

示例10: createSignature

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
public static GrClosureSignature createSignature(MethodSignature signature) {
  final PsiType[] types = signature.getParameterTypes();
  GrClosureParameter[] parameters = new GrClosureParameter[types.length];
  ContainerUtil.map(types, new Function<PsiType, GrClosureParameter>() {
    @Override
    public GrClosureParameter fun(PsiType type) {
      return new GrClosureParameterImpl(type, null, false, null);
    }
  }, parameters);
  return new GrClosureSignatureImpl(parameters, null, false, false);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GrClosureSignatureUtil.java

示例11: MethodReferenceConflictResolver

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private MethodReferenceConflictResolver(PsiMethodReferenceExpressionImpl referenceExpression,
		PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
		@Nullable MethodSignature signature,
		boolean varArgs)
{
	super(referenceExpression, signature != null ? signature.getParameterTypes() : PsiType.EMPTY_ARRAY, PsiUtil.getLanguageLevel(referenceExpression));
	myReferenceExpression = referenceExpression;
	myQualifierResolveResult = qualifierResolveResult;
	myFunctionalMethodVarArgs = varArgs;
	mySignature = signature;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:MethodReferenceResolver.java

示例12: arrayCreationSignature

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private static boolean arrayCreationSignature(MethodSignature signature)
{
	final PsiType[] parameterTypes = signature.getParameterTypes();
	if(parameterTypes.length == 1 && parameterTypes[0] != null && TypeConversionUtil.isAssignable(PsiType.INT, parameterTypes[0]))
	{
		return true;
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:MethodReferenceResolver.java

示例13: isResolvedBySecondSearch

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
public static boolean isResolvedBySecondSearch(@NotNull PsiMethodReferenceExpression methodRef, @Nullable MethodSignature signature, boolean varArgs, boolean isStatic, int parametersCount)
{
	if(signature == null)
	{
		return false;
	}
	final QualifierResolveResult qualifierResolveResult = getQualifierResolveResult(methodRef);
	final PsiType[] functionalMethodParameterTypes = signature.getParameterTypes();
	return (parametersCount + 1 == functionalMethodParameterTypes.length && !varArgs || varArgs && functionalMethodParameterTypes.length > 0 && !isStatic) && isSecondSearchPossible
			(functionalMethodParameterTypes, qualifierResolveResult, methodRef);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:PsiMethodReferenceUtil.java

示例14: getFirstParameterType

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
public static PsiType getFirstParameterType(PsiType functionalInterfaceType, PsiElement context)
{
	final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
	final MethodSignature function = LambdaUtil.getFunction(resolveResult.getElement());
	if(function != null)
	{
		final int interfaceMethodParamsLength = function.getParameterTypes().length;
		if(interfaceMethodParamsLength > 0)
		{
			PsiType type = resolveResult.getSubstitutor().substitute(function.getParameterTypes()[0]);
			return type != null ? PsiUtil.captureToplevelWildcards(type, context) : null;
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:PsiMethodReferenceUtil.java

示例15: checkReturnTypeApplicable

import com.intellij.psi.util.MethodSignature; //导入方法依赖的package包/类
private static boolean checkReturnTypeApplicable(PsiClassType.ClassResolveResult resolveResult, final PsiClass aClass)
{
	final MethodSignature methodSignature = LambdaUtil.getFunction(aClass);
	if(methodSignature == null)
	{
		return false;
	}

	for(PsiTypeParameter parameter : aClass.getTypeParameters())
	{
		if(parameter.getExtendsListTypes().length == 0)
		{
			continue;
		}
		final PsiType substitution = resolveResult.getSubstitutor().substitute(parameter);
		if(substitution instanceof PsiWildcardType && !((PsiWildcardType) substitution).isBounded())
		{
			boolean depends = false;
			for(PsiType paramType : methodSignature.getParameterTypes())
			{
				if(LambdaUtil.depends(paramType, new LambdaUtil.TypeParamsChecker((PsiMethod) null, aClass)
				{
					@Override
					public boolean startedInference()
					{
						return true;
					}
				}, parameter))
				{
					depends = true;
					break;
				}
			}
			if(!depends)
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:42,代码来源:LambdaHighlightingUtil.java


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