本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeBinding.isParameterizedType方法的典型用法代码示例。如果您正苦于以下问题:Java TypeBinding.isParameterizedType方法的具体用法?Java TypeBinding.isParameterizedType怎么用?Java TypeBinding.isParameterizedType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeBinding
的用法示例。
在下文中一共展示了TypeBinding.isParameterizedType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: areSameTypes
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
/** Are both types identical wrt the unannotated type and any null type annotations? Only unstructured types and captures are considered. */
protected static boolean areSameTypes(TypeBinding requiredType, TypeBinding providedType, TypeBinding providedSubstitute) {
if (requiredType == providedType) //$IDENTITY-COMPARISON$ // short cut for really-really-same types
return true;
if (requiredType.isParameterizedType() || requiredType.isArrayType())
return false; // not analysing details here
if (TypeBinding.notEquals(requiredType, providedType)) {
if (requiredType instanceof CaptureBinding) {
// when providing exactly the lower bound of the required type we're definitely fine:
TypeBinding lowerBound = ((CaptureBinding)requiredType).lowerBound;
if (lowerBound != null && areSameTypes(lowerBound, providedType, providedSubstitute))
return true;
} else if (requiredType.kind() == Binding.TYPE_PARAMETER && requiredType == providedSubstitute) { //$IDENTITY-COMPARISON$
return true;
} else if (providedType instanceof CaptureBinding) {
// when requiring exactly the upper bound of the provided type we're fine, too:
TypeBinding upperBound = ((CaptureBinding)providedType).upperBound();
if (upperBound != null && areSameTypes(requiredType, upperBound, providedSubstitute))
return true;
}
return false;
}
return (requiredType.tagBits & TagBits.AnnotationNullMASK) == (providedType.tagBits & TagBits.AnnotationNullMASK);
}
示例2: internalResolveType
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
private TypeBinding internalResolveType(Scope scope, boolean checkBounds) {
// handle the error here
this.constant = Constant.NotAConstant;
if (this.resolvedType != null) // is a shared type reference which was already resolved
return this.resolvedType.isValidBinding() ? this.resolvedType : this.resolvedType.closestMatch(); // already reported error
TypeBinding type = this.resolvedType = getTypeBinding(scope);
// End resolution when getTypeBinding(scope) returns null. This may happen in
// certain circumstances, typically when an illegal access is done on a type
// variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749)
if (type == null) return null;
if (!type.isValidBinding()) {
Binding binding = scope.getTypeOrPackage(this.tokens);
if (binding instanceof PackageBinding) {
this.packageBinding = (PackageBinding) binding;
// Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609)
} else {
reportInvalidType(scope);
}
return null;
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=209936
// raw convert all enclosing types when dealing with Javadoc references
if (type.isGenericType() || type.isParameterizedType()) {
this.resolvedType = scope.environment().convertToRawType(type, true /*force the conversion of enclosing types*/);
}
return this.resolvedType;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavadocQualifiedTypeReference.java
示例3: recordNestedType
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public static void recordNestedType(ClassFile classFile, TypeBinding typeBinding) {
if (classFile.visitedTypes == null) {
classFile.visitedTypes = new HashSet(3);
} else if (classFile.visitedTypes.contains(typeBinding)) {
// type is already visited
return;
}
classFile.visitedTypes.add(typeBinding);
if (typeBinding.isParameterizedType()
&& ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) typeBinding;
ReferenceBinding genericType = parameterizedTypeBinding.genericType();
if ((genericType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
recordNestedType(classFile, genericType);
}
TypeBinding[] arguments = parameterizedTypeBinding.arguments;
if (arguments != null) {
for (int j = 0, max2 = arguments.length; j < max2; j++) {
TypeBinding argument = arguments[j];
if (argument.isWildcard()) {
WildcardBinding wildcardBinding = (WildcardBinding) argument;
TypeBinding bound = wildcardBinding.bound;
if (bound != null
&& ((bound.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
recordNestedType(classFile, bound);
}
ReferenceBinding superclass = wildcardBinding.superclass();
if (superclass != null
&& ((superclass.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
recordNestedType(classFile, superclass);
}
ReferenceBinding[] superInterfaces = wildcardBinding.superInterfaces();
if (superInterfaces != null) {
for (int k = 0, max3 = superInterfaces.length; k < max3; k++) {
ReferenceBinding superInterface = superInterfaces[k];
if ((superInterface.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
recordNestedType(classFile, superInterface);
}
}
}
} else if ((argument.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
recordNestedType(classFile, argument);
}
}
}
} else if (typeBinding.isTypeVariable()
&& ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
TypeVariableBinding typeVariableBinding = (TypeVariableBinding) typeBinding;
TypeBinding upperBound = typeVariableBinding.upperBound();
if (upperBound != null && ((upperBound.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
recordNestedType(classFile, upperBound);
}
TypeBinding[] upperBounds = typeVariableBinding.otherUpperBounds();
if (upperBounds != null) {
for (int k = 0, max3 = upperBounds.length; k < max3; k++) {
TypeBinding otherUpperBound = upperBounds[k];
if ((otherUpperBound.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
recordNestedType(classFile, otherUpperBound);
}
}
}
} else if (typeBinding.isNestedType()) {
classFile.recordInnerClasses(typeBinding);
}
}