本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType类的典型用法代码示例。如果您正苦于以下问题:Java TType类的具体用法?Java TType怎么用?Java TType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TType类属于org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types包,在下文中一共展示了TType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
@Override
public Iterator<TType> iterator() {
return new Iterator<TType>() {
public void remove() {
// do nothing
}
public boolean hasNext() {
return false;
}
public TType next() {
return null;
}
};
}
示例2: contains
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
@Override
public boolean contains(TType t) {
if (fEnumCache != null) return fEnumCache.contains(t);
if (t.equals(getJavaLangObject())) return true;
if (fLowerBounds.contains(t)) return true;
// Find the "lower frontier", i.e. the lower bound, and see whether
// the given type is a supertype of any of those.
for (Iterator<TType> lbIter = fLowerBounds /*.lowerBound() */.iterator(); lbIter.hasNext(); ) {
TType lb = lbIter.next();
if (TTypes.canAssignTo(lb, t)) return true;
}
return false;
}
示例3: declaredTypeOf
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
protected static TType declaredTypeOf(ConstraintVariable2 cv) {
// TODO: record original type of CollectionElementVariable2 iff source already had type
// parameter
return cv.getType();
// if (v instanceof ContextualExpressionVariable) {
// ContextualExpressionVariable ev= (ContextualExpressionVariable) v;
//
// return ev.getBinding();
// } else if (v instanceof ReturnTypeVariable) {
// ReturnTypeVariable rv= (ReturnTypeVariable) v;
//
// return rv.getBinding();
// } else if (v instanceof RawBindingVariable) {
// RawBindingVariable rv= (RawBindingVariable) v;
//
// return rv.getBinding();
// } else if (v instanceof ParameterTypeVariable) {
// ParameterTypeVariable pv= (ParameterTypeVariable) v;
//
// return pv.getBinding();
// } else
// return null;
}
示例4: iterator
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
@Override
public Iterator<TType> iterator() {
if (fEnumCache != null) return fEnumCache.iterator();
return new Iterator<TType>() {
Iterator<TType> fElemIter = fElemTypeSet.iterator();
public boolean hasNext() {
return fElemIter.hasNext();
}
public TType next() {
return TTypes.createArrayType(fElemIter.next(), 1);
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
示例5: makeTypeVariable
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
public TypeVariable2 makeTypeVariable(Type type) {
ICompilationUnit cu = RefactoringASTParser.getCompilationUnit(type);
TType ttype = getBoxedType(type.resolveBinding(), /*no boxing*/ null);
if (ttype == null) return null;
CompilationUnitRange range = new CompilationUnitRange(cu, type);
TypeVariable2 typeVariable = new TypeVariable2(ttype, range);
TypeVariable2 storedCv = (TypeVariable2) storedCv(typeVariable);
if (storedCv == typeVariable) {
fCuScopedConstraintVariables.add(storedCv);
if (isAGenericType(ttype)) makeElementVariables(storedCv, ttype);
makeArrayElementVariable(storedCv);
if (fStoreToString) storedCv.setData(ConstraintVariable2.TO_STRING, type.toString());
}
return storedCv;
}
示例6: makeParameterTypeVariable
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
public ParameterTypeVariable2 makeParameterTypeVariable(
IMethodBinding methodBinding, int parameterIndex) {
if (methodBinding == null) return null;
TType type =
getBoxedType(methodBinding.getParameterTypes()[parameterIndex], /*no boxing*/ null);
if (type == null) return null;
ParameterTypeVariable2 cv = new ParameterTypeVariable2(type, parameterIndex, methodBinding);
ParameterTypeVariable2 storedCv = (ParameterTypeVariable2) storedCv(cv);
if (storedCv == cv) {
if (methodBinding.getDeclaringClass().isLocal()
|| Modifier.isPrivate(methodBinding.getModifiers())) fCuScopedConstraintVariables.add(cv);
makeElementVariables(storedCv, type);
makeArrayElementVariable(storedCv);
if (fStoreToString)
storedCv.setData(
ConstraintVariable2.TO_STRING,
"[Parameter("
+ parameterIndex
+ ","
+ Bindings.asString(methodBinding)
+ ")]"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return storedCv;
}
示例7: makeReturnTypeVariable
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
public ReturnTypeVariable2 makeReturnTypeVariable(IMethodBinding methodBinding) {
if (methodBinding == null) return null;
TType returnType = getBoxedType(methodBinding.getReturnType(), /*no boxing*/ null);
if (returnType == null) return null;
ReturnTypeVariable2 cv = new ReturnTypeVariable2(returnType, methodBinding);
ReturnTypeVariable2 storedCv = (ReturnTypeVariable2) storedCv(cv);
if (cv == storedCv) {
makeElementVariables(storedCv, returnType);
makeArrayElementVariable(storedCv);
if (fStoreToString)
storedCv.setData(
ConstraintVariable2.TO_STRING,
"[ReturnType(" + Bindings.asString(methodBinding) + ")]"); // $NON-NLS-1$ //$NON-NLS-2$
}
return storedCv;
}
示例8: 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());
}
示例9: 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);
}
}
示例10: contains
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
@Override
public boolean contains(TType t) {
if (fEnumCache != null) return fEnumCache.contains(t);
if (fUpperBounds.contains(t)) return true;
// Find the "upper frontier", i.e. the upper bound, and see whether
// the given type is a subtype of any of those.
Iterator<TType> ubIter = fUpperBounds.upperBound().iterator();
for (; ubIter.hasNext(); ) {
TType ub = ubIter.next();
if (TTypes.canAssignTo(t, ub)) return true;
}
return false;
}
示例11: createVariablesFor
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
private Collection<CollectionElementVariable2> createVariablesFor(ConstraintVariable2 v) {
ParametricStructure t = elemStructure(v);
if (t == null || t == ParametricStructure.NONE) return Collections.emptyList();
ParametricStructure parmType = t;
TType base = parmType.getBase();
if (isParametricType(base)) {
return createAndInitVars(v, parmType);
}
throw new IllegalStateException(
"Attempt to create element variables for parametric variable of unknown type: "
+ parmType); // $NON-NLS-1$
}
示例12: enumerate
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
if (fEnumCache == null) {
fEnumCache = new EnumeratedTypeSet(getTypeSetEnvironment());
for (Iterator<TType> iter = fElemTypeSet.iterator(); iter.hasNext(); ) {
TType t = iter.next();
fEnumCache.add(TTypes.createArrayType(t, 1));
}
fEnumCache.initComplete();
}
return fEnumCache;
}
示例13: makeParameterizedTypeVariable
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
private ParameterizedTypeVariable2 makeParameterizedTypeVariable(TType type) {
Assert.isTrue(isAGenericType(type));
ParameterizedTypeVariable2 cv = new ParameterizedTypeVariable2(type);
ParameterizedTypeVariable2 storedCv = (ParameterizedTypeVariable2) storedCv(cv);
if (cv == storedCv) {
fCuScopedConstraintVariables.add(storedCv);
makeElementVariables(storedCv, type);
if (fStoreToString)
storedCv.setData(
ConstraintVariable2.TO_STRING,
"ParameterizedType(" + type.getPrettySignature() + ")"); // $NON-NLS-1$ //$NON-NLS-2$
}
return storedCv;
}
示例14: makeImmutableTypeVariable
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入依赖的package包/类
public ImmutableTypeVariable2 makeImmutableTypeVariable(
ITypeBinding typeBinding, Expression expression) {
// Assert.isTrue(! typeBinding.isGenericType()); // see JDT/Core bug 80472
TType type = getBoxedType(typeBinding, expression);
if (type == null) return null;
return makeImmutableTypeVariable(type);
}
示例15: 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());
}