本文整理匯總了Java中org.eclipse.jdt.core.dom.ITypeBinding.isNullType方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypeBinding.isNullType方法的具體用法?Java ITypeBinding.isNullType怎麽用?Java ITypeBinding.isNullType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.ITypeBinding
的用法示例。
在下文中一共展示了ITypeBinding.isNullType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createName
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
static void createName(ITypeBinding type, boolean includePackage,
List<String> list) {
ITypeBinding baseType = type;
if (type.isArray()) {
baseType = type.getElementType();
}
if (!baseType.isPrimitive() && !baseType.isNullType()) {
ITypeBinding declaringType = baseType.getDeclaringClass();
if (declaringType != null) {
createName(declaringType, includePackage, list);
} else if (includePackage && !baseType.getPackage().isUnnamed()) {
String[] components = baseType.getPackage().getNameComponents();
for (int i = 0; i < components.length; i++) {
list.add(components[i]);
}
}
}
if (!baseType.isAnonymous()) {
list.add(type.getName());
} else {
list.add("$local$"); //$NON-NLS-1$
}
}
示例2: createName
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static void createName(ITypeBinding type, boolean includePackage, List<String> list) {
ITypeBinding baseType= type;
if (type.isArray()) {
baseType= type.getElementType();
}
if (!baseType.isPrimitive() && !baseType.isNullType()) {
ITypeBinding declaringType= baseType.getDeclaringClass();
if (declaringType != null) {
createName(declaringType, includePackage, list);
} else if (includePackage && !baseType.getPackage().isUnnamed()) {
String[] components= baseType.getPackage().getNameComponents();
for (int i= 0; i < components.length; i++) {
list.add(components[i]);
}
}
}
if (!baseType.isAnonymous()) {
list.add(type.getName());
} else {
list.add("$local$"); //$NON-NLS-1$
}
}
示例3: normalizeTypeBinding
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
* Normalizes a type binding received from an expression to a type binding that can be used inside a
* declaration signature, but <em>not</em> as type of a declaration (use {@link #normalizeForDeclarationUse(ITypeBinding, AST)} for that).
* <p>
* Anonymous types are normalized to the super class or interface. For
* null or void bindings, <code>null</code> is returned.
* </p>
*
* @param binding the binding to normalize
* @return the normalized binding, can be <code>null</code>
*
* @see #normalizeForDeclarationUse(ITypeBinding, AST)
*/
public static ITypeBinding normalizeTypeBinding(ITypeBinding binding) {
if (binding != null && !binding.isNullType() && !isVoidType(binding)) {
if (binding.isAnonymous()) {
ITypeBinding[] baseBindings= binding.getInterfaces();
if (baseBindings.length > 0) {
return baseBindings[0];
}
return binding.getSuperclass();
}
if (binding.isCapture()) {
return binding.getWildcard();
}
return binding;
}
return null;
}
示例4: getArgumentTypes
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static ITypeBinding[] getArgumentTypes(List<Expression> arguments) {
ITypeBinding[] res= new ITypeBinding[arguments.size()];
for (int i= 0; i < res.length; i++) {
Expression expression= arguments.get(i);
ITypeBinding curr= expression.resolveTypeBinding();
if (curr == null) {
return null;
}
if (!curr.isNullType()) { // don't normalize null type
curr= Bindings.normalizeTypeBinding(curr);
if (curr == null) {
curr= expression.getAST().resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
}
}
res[i]= curr;
}
return res;
}
示例5: normalizeForDeclarationUse
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
* Normalizes the binding so that it can be used as a type inside a declaration (e.g. variable
* declaration, method return type, parameter type, ...).
* For null bindings, java.lang.Object is returned.
* For void bindings, <code>null</code> is returned.
*
* @param binding binding to normalize
* @param ast current AST
* @return the normalized type to be used in declarations, or <code>null</code>
*/
public static ITypeBinding normalizeForDeclarationUse(ITypeBinding binding, AST ast) {
if (binding.isNullType())
{
return ast.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
}
if (binding.isPrimitive()) {
return binding;
}
binding= normalizeTypeBinding(binding);
if (binding == null) {
return binding;
}
if (binding.isArray()) {
return normalizeForDeclarationUse(binding.getComponentType(), ast).createArrayType(1);
}
if (!binding.isWildcardType()) {
return binding;
}
ITypeBinding bound= binding.getBound();
if (bound == null || !binding.isUpperbound()) {
ITypeBinding[] typeBounds= binding.getTypeBounds();
if (typeBounds.length > 0) {
return typeBounds[0];
} else {
return binding.getErasure();
}
} else {
return bound;
}
}
示例6: transfer
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
* x := y
*/
@Override
public OOGContext transfer(CopyInstruction instr, OOGContext value) {
super.transfer(instr, value);
//Set of variables of the instruction in case of a conflict
Set<Variable> varSet = new HashSet<Variable>();
// Skip over the ones you do not to re-analyze...
if(skipExprs.contains(instr)) {
return super.transfer(instr, value);
}
ASTNode node = instr.getNode();
String encClassName = Utils.findEnclosingClassName(node);
boolean isMainClass = encClassName.equals(Config.MAINCLASS);
String currentReceiverName = value.getCurrentReceiverName();
Variable leftHandSide = instr.getTarget();
varSet.add(leftHandSide);
ITypeBinding lhsType = leftHandSide.resolveType();
if(!lhsType.isPrimitive()){
Set<OType> leftHandSideOType = this.tm.getTypeMapping(leftHandSide);
if(leftHandSideOType == null){
if(currentReceiverName.equals("new")){
leftHandSideOType = this.tm.initTypeMapping(isMainClass,leftHandSide, false, true);
}
else{
leftHandSideOType = this.tm.initTypeMapping(isMainClass,leftHandSide, true, true);
}
this.tm.putTypeMapping(leftHandSide, leftHandSideOType);
}
Set<OType> newleftHandSideOType = new HashSet<OType>(leftHandSideOType);
Variable rightHandSide = instr.getOperand();
varSet.add(rightHandSide);
ITypeBinding rhsType = rightHandSide.resolveType();
if(!rhsType.isPrimitive() && !rhsType.isNullType()){
Set<OType> rightHandSideOType = this.tm.getTypeMapping(rightHandSide);
if(rightHandSideOType == null){
if(currentReceiverName.equals("new")){
rightHandSideOType = this.tm.initTypeMapping(isMainClass,rightHandSide, false, true);
}
else{
rightHandSideOType = this.tm.initTypeMapping(isMainClass,rightHandSide, true, true);
}
this.tm.putTypeMapping(rightHandSide, rightHandSideOType);
}
else{
if(currentReceiverName!=null){
if(!currentReceiverName.equals("new") && !currentReceiverName.equals("this")){
createChangingQualifiers(currentReceiverName, leftHandSideOType, rightHandSideOType, newleftHandSideOType);
}
// if the right hand side of the copy construction is a new expression
// else{
// rightHandSideOType.addAll(newleftHandSideOType);
// }
}
}
newleftHandSideOType.retainAll(rightHandSideOType);
this.tm.putTypeMapping(leftHandSide, newleftHandSideOType);
this.tm.putTypeMapping(rightHandSide, newleftHandSideOType);
if(newleftHandSideOType.size()==0){
emptySetAction(instr, "The left hand side and right hand side of the assignment statement: ",varSet);
return value;
}
}
}
return value;
}