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


Java PsiUtil.ensureValidType方法代码示例

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


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

示例1: normalizeWildcardTypeByPosition

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
public static PsiType normalizeWildcardTypeByPosition(@NotNull PsiType type, @NotNull PsiExpression expression) {
  PsiUtilCore.ensureValid(expression);
  PsiUtil.ensureValidType(type);

  PsiExpression topLevel = expression;
  while (topLevel.getParent() instanceof PsiArrayAccessExpression &&
         ((PsiArrayAccessExpression)topLevel.getParent()).getArrayExpression() == topLevel) {
    topLevel = (PsiExpression)topLevel.getParent();
  }

  if (topLevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(topLevel)) {
    return PsiUtil.captureToplevelWildcards(type, expression);
  }

  final PsiType normalized = doNormalizeWildcardByPosition(type, expression, topLevel);
  LOG.assertTrue(normalized.isValid(), type);
  if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(topLevel)) {
    return PsiUtil.captureToplevelWildcards(normalized, expression);
  }

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

示例2: ExpectedTypeInfoImpl

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
public ExpectedTypeInfoImpl(@NotNull PsiType type,
                            @Type int kind,
                            @NotNull PsiType defaultType,
                            @NotNull TailType myTailType,
                            PsiMethod calledMethod,
                            @NotNull NullableComputable<String> expectedName) {
  this.type = type;
  this.kind = kind;

  this.myTailType = myTailType;
  this.defaultType = defaultType;
  myCalledMethod = calledMethod;
  this.expectedNameComputable = expectedName;
  expectedNameLazyValue = new VolatileNullableLazyValue<String>() {
    @Nullable
    @Override
    protected String compute() {
      return expectedNameComputable.compute();
    }
  };

  PsiUtil.ensureValidType(type);
  PsiUtil.ensureValidType(defaultType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExpectedTypeInfoImpl.java

示例3: substitute

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public PsiType substitute(PsiType type) {
  if (type == null) {
    //noinspection ConstantConditions
    return null;
  }
  PsiUtil.ensureValidType(type);
  PsiType substituted = type.accept(mySimpleSubstitutionVisitor);
  return correctExternalSubstitution(substituted, type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiSubstitutorImpl.java

示例4: ensureValid

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void ensureValid() {
  for (PsiType type : mySubstitutionMap.values()) {
    if (type != null) {
      PsiUtil.ensureValidType(type);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PsiSubstitutorImpl.java

示例5: DfaVariableValue

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private DfaVariableValue(@NotNull PsiModifierListOwner variable, @Nullable PsiType varType, boolean isNegated, DfaValueFactory factory, @Nullable DfaVariableValue qualifier) {
  super(factory);
  myVariable = variable;
  myIsNegated = isNegated;
  myQualifier = qualifier;
  myVarType = varType;
  DfaValue typeValue = myFactory.createTypeValue(varType, Nullness.UNKNOWN);
  myTypeValue = typeValue instanceof DfaTypeValue ? (DfaTypeValue)typeValue : null;
  if (varType != null && !varType.isValid()) {
    PsiUtil.ensureValidType(varType, "Variable: " + variable + " of class " + variable.getClass());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DfaVariableValue.java

示例6: getPropertiesHandlersNames

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private static String[] getPropertiesHandlersNames(final PsiClass psiClass,
                                                  final boolean staticContext,
                                                  final PsiType varType,
                                                  final PsiElement element) {
  final List<String> propertyHandlers = new ArrayList<String>();

  for (final PsiField field : psiClass.getFields()) {
    if (field == element) continue;
    if (StringUtil.isEmpty(field.getName())) continue;

    PsiUtilCore.ensureValid(field);
    PsiType fieldType = field.getType();
    PsiUtil.ensureValidType(fieldType);

    final PsiModifierList modifierList = field.getModifierList();
    if (staticContext && (modifierList != null && !modifierList.hasModifierProperty(PsiModifier.STATIC))) continue;

    if (fieldType.equals(varType)) {
      final String getterName = PropertyUtil.suggestGetterName(field);
      if ((psiClass.findMethodsByName(getterName, true).length == 0 ||
           psiClass.findMethodBySignature(GenerateMembersUtil.generateGetterPrototype(field), true) == null)) {
        propertyHandlers.add(getterName);
      }
    }

    if (PsiType.VOID.equals(varType)) {
      final String setterName = PropertyUtil.suggestSetterName(field);
      if ((psiClass.findMethodsByName(setterName, true).length == 0 ||
           psiClass.findMethodBySignature(GenerateMembersUtil.generateSetterPrototype(field), true) == null)) {
        propertyHandlers.add(setterName);
      }
    }
  }

  return ArrayUtil.toStringArray(propertyHandlers);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:JavaMemberNameCompletionContributor.java


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