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


Java TType.getTypeDeclaration方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType.getTypeDeclaration方法的典型用法代码示例。如果您正苦于以下问题:Java TType.getTypeDeclaration方法的具体用法?Java TType.getTypeDeclaration怎么用?Java TType.getTypeDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType的用法示例。


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

示例1: makeFixedElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入方法依赖的package包/类
public void makeFixedElementVariables(ConstraintVariable2 expressionCv, TType type) {
  if (isAGenericType(type)) {
    GenericType genericType = (GenericType) type.getTypeDeclaration();
    TType[] typeParameters = genericType.getTypeParameters();
    TType[] typeArguments = null;
    if (type.isParameterizedType()) typeArguments = ((ParameterizedType) type).getTypeArguments();

    for (int i = 0; i < typeParameters.length; i++) {
      TypeVariable typeVariable = (TypeVariable) typeParameters[i];
      CollectionElementVariable2 elementCv = makeElementVariable(expressionCv, typeVariable, i);
      TType referenceTypeArgument;
      if (typeArguments == null) { // raw type
        continue; // do not consider
      } else {
        referenceTypeArgument = typeArguments[i];
      }
      createEqualsConstraint(elementCv, makeImmutableTypeVariable(referenceTypeArgument));
      //				if (typeVariable.getBounds().length != 0) {
      //					//TODO: create subtype constraints for bounds
      //				}
    }
  }
  makeFixedElementVariablesFromSupertypes(expressionCv, type.getTypeDeclaration());
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:InferTypeArgumentsTCModel.java

示例2: canAssignTo

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入方法依赖的package包/类
/**
 * @param rhs
 * @param lhs
 * @return <code>true</code> iff an expression of type 'rhs' can be assigned to a variable of type
 *     'lhs'. Type arguments of generic / raw / parameterized types are <b>not</b> considered.
 */
public static boolean canAssignTo(TType rhs, TType lhs) {
  if (rhs.isHierarchyType() && lhs.isHierarchyType()) {
    HierarchyType rhsGeneric = (HierarchyType) rhs.getTypeDeclaration();
    HierarchyType lhsGeneric = (HierarchyType) lhs.getTypeDeclaration();
    return lhs.isJavaLangObject()
        || rhsGeneric.equals(lhsGeneric)
        || rhsGeneric.isSubType(lhsGeneric);

  } else if (rhs.isTypeVariable()) {
    if (rhs.canAssignTo(lhs)) return true;
    TType[] bounds = ((TypeVariable) rhs).getBounds();
    for (int i = 0; i < bounds.length; i++) {
      if (canAssignTo(bounds[i], lhs)) return true;
    }
    return lhs.isJavaLangObject();

  } else {
    return rhs.canAssignTo(lhs);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:TTypes.java

示例3: makeElementVariables

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入方法依赖的package包/类
public void makeElementVariables(ConstraintVariable2 expressionCv, TType type) {
  if (isAGenericType(type)) {
    GenericType genericType = (GenericType) type.getTypeDeclaration();
    TType[] typeParameters = genericType.getTypeParameters();
    for (int i = 0; i < typeParameters.length; i++) {
      TypeVariable typeVariable = (TypeVariable) typeParameters[i];
      makeElementVariable(expressionCv, typeVariable, i);
      if (typeVariable.getBounds().length != 0) {
        // TODO: create subtype constraints for bounds
      }
    }
  }
  makeElementVariablesFromSupertypes(expressionCv, type.getTypeDeclaration());
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:InferTypeArgumentsTCModel.java

示例4: newParametricType

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入方法依赖的package包/类
private ParametricStructure newParametricType(TType varType) {
  // TODO: create CollectionElementVariable2s if necessary?
  GenericType genericType = (GenericType) varType.getTypeDeclaration();
  return new ParametricStructure(genericType);
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:ParametricStructureComputer.java


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