當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。