本文整理匯總了Java中org.eclipse.jdt.core.dom.ITypeBinding.isRawType方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypeBinding.isRawType方法的具體用法?Java ITypeBinding.isRawType怎麽用?Java ITypeBinding.isRawType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.ITypeBinding
的用法示例。
在下文中一共展示了ITypeBinding.isRawType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTypeBoundsForSubsignature
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static Set<ITypeBinding> getTypeBoundsForSubsignature(ITypeBinding typeParameter) {
ITypeBinding[] typeBounds= typeParameter.getTypeBounds();
int count= typeBounds.length;
if (count == 0) {
return Collections.emptySet();
}
Set<ITypeBinding> result= new HashSet<>(typeBounds.length);
for (int i= 0; i < typeBounds.length; i++) {
ITypeBinding bound= typeBounds[i];
if ("java.lang.Object".equals(typeBounds[0].getQualifiedName())) {
continue;
} else if (containsTypeVariables(bound)) {
result.add(bound.getErasure()); // try to achieve effect of "rename type variables"
} else if (bound.isRawType()) {
result.add(bound.getTypeDeclaration());
} else {
result.add(bound);
}
}
return result;
}
示例2: getExplicitCast
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
* Returns the type to which an inlined variable initializer should be cast, or
* <code>null</code> if no cast is necessary.
*
* @param initializer the initializer expression of the variable to inline
* @param reference the reference to the variable (which is to be inlined)
* @return a type binding to which the initializer should be cast, or <code>null</code> iff no cast is necessary
* @since 3.6
*/
public static ITypeBinding getExplicitCast(Expression initializer, Expression reference) {
ITypeBinding initializerType= initializer.resolveTypeBinding();
ITypeBinding referenceType= reference.resolveTypeBinding();
if (initializerType == null || referenceType == null) {
return null;
}
if (initializerType.isPrimitive() && referenceType.isPrimitive() && ! referenceType.isEqualTo(initializerType)) {
return referenceType;
} else if (initializerType.isPrimitive() && ! referenceType.isPrimitive()) { // initializer is autoboxed
ITypeBinding unboxedReferenceType= Bindings.getUnboxedTypeBinding(referenceType, reference.getAST());
if (!unboxedReferenceType.isEqualTo(initializerType)) {
return unboxedReferenceType;
} else if (needsExplicitBoxing(reference)) {
return referenceType;
}
} else if (! initializerType.isPrimitive() && referenceType.isPrimitive()) { // initializer is autounboxed
ITypeBinding unboxedInitializerType= Bindings.getUnboxedTypeBinding(initializerType, reference.getAST());
if (!unboxedInitializerType.isEqualTo(referenceType)) {
return referenceType;
}
} else if (initializerType.isRawType() && referenceType.isParameterizedType()) {
return referenceType; // don't lose the unchecked conversion
} else if (initializer instanceof LambdaExpression || initializer instanceof MethodReference) {
if (isTargetAmbiguous(reference, isExplicitlyTypedLambda(initializer))) {
return referenceType;
} else {
ITypeBinding targetType= getTargetType(reference);
if (targetType == null || targetType != referenceType) {
return referenceType;
}
}
} else if (! TypeRules.canAssign(initializerType, referenceType)) {
if (!Bindings.containsTypeVariables(referenceType)) {
return referenceType;
}
}
return null;
}