本文整理汇总了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;
}
示例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)));
}
示例3: isVarArgs
import com.intellij.psi.PsiEllipsisType; //导入依赖的package包/类
@Override
public boolean isVarArgs() {
return getType() instanceof PsiEllipsisType;
}
示例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);
}
示例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);
}
});
}
示例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;
}