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


Java PsiEllipsisType类代码示例

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


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

示例1: findConversion

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
@NonNls
@Nullable
public TypeConversionDescriptorBase findConversion(final PsiType from,
		final PsiType to,
		final PsiMember member,
		final PsiExpression context,
		final boolean isCovariantPosition,
		final TypeMigrationLabeler labeler)
{
	final TypeConversionDescriptorBase conversion = findConversion(from, to, member, context, labeler);
	if(conversion != null)
	{
		return conversion;
	}

	if(isCovariantPosition)
	{
		if(to instanceof PsiEllipsisType)
		{
			if(TypeConversionUtil.isAssignable(((PsiEllipsisType) to).getComponentType(), from))
			{
				return new TypeConversionDescriptorBase();
			}
		}
		if(TypeConversionUtil.isAssignable(to, from))
		{
			return new TypeConversionDescriptorBase();
		}
	}

	return !isCovariantPosition && TypeConversionUtil.isAssignable(from, to) ? new TypeConversionDescriptorBase() : null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:33,代码来源:TypeMigrationRules.java

示例2: testTypeArrayVararg2Lvalue

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
public void testTypeArrayVararg2Lvalue() throws Exception {
  doTestFirstParamType("meth", "Type",
               myJavaFacade.getElementFactory().createTypeFromText("Descendant", null).createArrayType(),
               new PsiEllipsisType(myJavaFacade.getElementFactory().createTypeFromText("Subject", null)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:MigrateTypeSignatureTest.java

示例3: isVarArgs

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
@Override
public boolean isVarArgs() {
  return getType() instanceof PsiEllipsisType;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GrLightParameter.java

示例4: LightParameter

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
public LightParameter(@NotNull String name, @NotNull PsiType type, PsiElement declarationScope, Language language) {
  this(name, type, declarationScope, language, type instanceof PsiEllipsisType);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:4,代码来源:LightParameter.java

示例5: withParameters

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
/**
 * Selects the corrected method by argument types
 * @param inputTypes the array of FQN of the parameter types or wildcards.
 * The special values are:<bl><li>"?" - means any type</li><li>".." - instructs pattern to accept the rest of the arguments</li></bl>
 * @return
 */
public PsiMethodPattern withParameters(@NonNls final String... inputTypes) {
  final String[] types = inputTypes.length == 0 ? ArrayUtil.EMPTY_STRING_ARRAY : inputTypes;
  return with(new PatternCondition<PsiMethod>("withParameters") {
    @Override
    public boolean accepts(@NotNull final PsiMethod psiMethod, final ProcessingContext context) {
      final PsiParameterList parameterList = psiMethod.getParameterList();
      int dotsIndex = -1;
      while (++dotsIndex <types.length) {
        if (Comparing.equal("..", types[dotsIndex])) break;
      }

      if (dotsIndex == types.length && parameterList.getParametersCount() != dotsIndex
        || dotsIndex < types.length && parameterList.getParametersCount() < dotsIndex) {
        return false;
      }
      if (dotsIndex > 0) {
        final PsiParameter[] psiParameters = parameterList.getParameters();
        for (int i = 0; i < dotsIndex; i++) {
          if (!Comparing.equal("?", types[i]) && !typeEquivalent(psiParameters[i].getType(), types[i])) {
            return false;
          }
        }
      }
      return true;
    }

    private boolean typeEquivalent(PsiType type, String expectedText) {
      final PsiType erasure = TypeConversionUtil.erasure(type);
      final String text;
      if (erasure instanceof PsiEllipsisType && expectedText.endsWith("[]")) {
        text = ((PsiEllipsisType)erasure).getComponentType().getCanonicalText() + "[]";
      }
      else if (erasure instanceof PsiArrayType && expectedText.endsWith("...")) {
        text = ((PsiArrayType)erasure).getComponentType().getCanonicalText() +"...";
      }
      else {
        text = erasure.getCanonicalText();
      }
      return expectedText.equals(text);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:49,代码来源:PsiMethodPattern.java

示例6: MethodArgumentFix

import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
protected MethodArgumentFix(PsiExpressionList list, int i, PsiType toType, ArgumentFixerActionFactory fixerActionFactory) {
  myArgList = list;
  myIndex = i;
  myArgumentFixerActionFactory = fixerActionFactory;
  myToType = toType instanceof PsiEllipsisType ? ((PsiEllipsisType) toType).toArrayType() : toType;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:MethodArgumentFix.java


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