• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ParameterizedTypeBinding类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedTypeBinding类的具体用法?Java ParameterizedTypeBinding怎么用?Java ParameterizedTypeBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ParameterizedTypeBinding类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了ParameterizedTypeBinding类的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: inheritsAnno

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
/**
 * Check whether an element has a superclass that is annotated with an @Inherited annotation.
 * @param element must be a class (not an interface, enum, etc.).
 * @param anno must be an annotation type, and must be @Inherited
 * @return true if element has a superclass that is annotated with anno
 */
private boolean inheritsAnno(ReferenceBinding element, ReferenceBinding anno) {
	ReferenceBinding searchedElement = element;
	do {
		if (searchedElement instanceof ParameterizedTypeBinding) {
			searchedElement = ((ParameterizedTypeBinding) searchedElement).genericType();
		}
		AnnotationBinding[] annos = Factory.getPackedAnnotationBindings(searchedElement.getAnnotations());
		for (AnnotationBinding annoBinding : annos) {
			if (annoBinding.getAnnotationType() == anno) { //$IDENTITY-COMPARISON$
				// element is annotated with anno
				return true;
			}
		}
	} while (null != (searchedElement = searchedElement.superclass()));
	return false;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:23,
代码来源:RoundEnvImpl.java

示例2: acceptLocalType

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public void acceptLocalType(TypeBinding typeBinding) {
	IJavaElement res =  null;
	if(typeBinding instanceof ParameterizedTypeBinding) {
		LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeBinding).genericType();
		res = findLocalElement(localTypeBinding.sourceStart());
	} else if(typeBinding instanceof SourceTypeBinding) {
		res = findLocalElement(((SourceTypeBinding)typeBinding).sourceStart());
	}
	if(res != null && res.getElementType() == IJavaElement.TYPE) {
		res = ((JavaElement)res).resolved(typeBinding);
		addElement(res);
		if(SelectionEngine.DEBUG){
			System.out.print("SELECTION - accept type("); //$NON-NLS-1$
			System.out.print(res.toString());
			System.out.println(")"); //$NON-NLS-1$
		}
	}
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:19,
代码来源:SelectionRequestor.java

示例3: acceptLocalTypeParameter

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public void acceptLocalTypeParameter(TypeVariableBinding typeVariableBinding) {
	IJavaElement res;
	if(typeVariableBinding.declaringElement instanceof ParameterizedTypeBinding) {
		LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeVariableBinding.declaringElement).genericType();
		res = findLocalElement(localTypeBinding.sourceStart());
	} else {
		SourceTypeBinding typeBinding = (SourceTypeBinding)typeVariableBinding.declaringElement;
		res = findLocalElement(typeBinding.sourceStart());
	}
	if (res != null && res.getElementType() == IJavaElement.TYPE) {
		IType type = (IType) res;
		ITypeParameter typeParameter = type.getTypeParameter(new String(typeVariableBinding.sourceName));
		if (typeParameter.exists()) {
			addElement(typeParameter);
			if(SelectionEngine.DEBUG){
				System.out.print("SELECTION - accept type parameter("); //$NON-NLS-1$
				System.out.print(typeParameter.toString());
				System.out.println(")"); //$NON-NLS-1$
			}
		}
	}
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:23,
代码来源:SelectionRequestor.java

示例4: getAnnotations

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public IAnnotationBinding[] getAnnotations() {
	if (this.prototype != null) {
		return this.prototype.getAnnotations();
	}
	if (this.annotations != null) {
		return this.annotations;
	}
	org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding refType = null;
	if (this.binding instanceof ParameterizedTypeBinding) {
		refType = ((ParameterizedTypeBinding) this.binding).genericType();
	} else if (this.binding.isAnnotationType() || this.binding.isClass() || this.binding.isEnum() || this.binding.isInterface()) {
		refType = (org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding) this.binding;
	}
	if (refType != null) {
		return this.annotations = resolveAnnotationBindings(refType.getAnnotations(), false);
	}
	return this.annotations = AnnotationBinding.NoAnnotations;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:19,
代码来源:TypeBinding.java

示例5: getTypeArguments

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public ITypeBinding[] getTypeArguments() {
	if (this.prototype != null) {
		return this.prototype.getTypeArguments();
	}
	if (this.typeArguments != null) {
		return this.typeArguments;
	}
	if (this.binding.isParameterizedTypeWithActualArguments()) {
		ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
		final org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] arguments = parameterizedTypeBinding.arguments;
		int argumentsLength = arguments.length;
		ITypeBinding[] newTypeArguments = new ITypeBinding[argumentsLength];
		for (int i = 0; i < argumentsLength; i++) {
			ITypeBinding typeBinding = this.resolver.getTypeBinding(arguments[i]);
			if (typeBinding == null) {
				return this.typeArguments = NO_TYPE_BINDINGS;
			}
			newTypeArguments[i] = typeBinding;
		}
		return this.typeArguments = newTypeArguments;
	}
	return this.typeArguments = NO_TYPE_BINDINGS;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:24,
代码来源:TypeBinding.java

示例6: inheritsAnno

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
/**
 * Check whether an element has a superclass that is annotated with an @Inherited annotation.
 * @param element must be a class (not an interface, enum, etc.).
 * @param anno must be an annotation type, and must be @Inherited
 * @return true if element has a superclass that is annotated with anno
 */
private boolean inheritsAnno(ReferenceBinding element, ReferenceBinding anno) {
	ReferenceBinding searchedElement = element;
	do {
		if (searchedElement instanceof ParameterizedTypeBinding) {
			searchedElement = ((ParameterizedTypeBinding) searchedElement).genericType();
		}
		AnnotationBinding[] annos = searchedElement.getAnnotations();
		for (AnnotationBinding annoBinding : annos) {
			if (annoBinding.getAnnotationType() == anno) {
				// element is annotated with anno
				return true;
			}
		}
	} while (null != (searchedElement = searchedElement.superclass()));
	return false;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion-Juno38,
代码行数:23,
代码来源:RoundEnvImpl.java

示例7: getTypeArguments

点赞 3

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public ITypeBinding[] getTypeArguments() {
	if (this.typeArguments != null) {
		return this.typeArguments;
	}
	if (this.binding.isParameterizedTypeWithActualArguments()) {
		ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
		final org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] arguments = parameterizedTypeBinding.arguments;
		int argumentsLength = arguments.length;
		ITypeBinding[] newTypeArguments = new ITypeBinding[argumentsLength];
		for (int i = 0; i < argumentsLength; i++) {
			ITypeBinding typeBinding = this.resolver.getTypeBinding(arguments[i]);
			if (typeBinding == null) {
				return this.typeArguments = NO_TYPE_BINDINGS;
			}
			newTypeArguments[i] = typeBinding;
		}
		return this.typeArguments = newTypeArguments;
	}
	return this.typeArguments = NO_TYPE_BINDINGS;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion-Juno38,
代码行数:21,
代码来源:TypeBinding.java

示例8: visitRaw

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public void visitRaw(Binding binding) {
	if (binding == null) return;
	if (binding instanceof MethodBinding) visitMethod((MethodBinding) binding);
	if (binding instanceof BaseTypeBinding) visitBase((BaseTypeBinding) binding);
	if (binding instanceof ArrayBinding) visitArray((ArrayBinding) binding);
	if (binding instanceof UnresolvedReferenceBinding) visitUnresolved((UnresolvedReferenceBinding) binding);
	if (binding instanceof WildcardBinding) visitWildcard((WildcardBinding) binding);
	if (binding instanceof TypeVariableBinding) visitTypeVariable((TypeVariableBinding) binding);
	if (binding instanceof ParameterizedTypeBinding) visitParameterized((ParameterizedTypeBinding) binding);
	if (binding instanceof ReferenceBinding) visitReference((ReferenceBinding) binding);
}
 

开发者ID:git03394538,
项目名称:lombok-ianchiu,
代码行数:12,
代码来源:PatchDelegate.java

示例9: visitParameterized

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public void visitParameterized(ParameterizedTypeBinding binding) {
	visitRaw(binding.genericType());
	TypeVariableBinding[] typeVars = binding.typeVariables();
	if (typeVars != null) for (TypeVariableBinding child : typeVars) {
		visitRaw(child);
	}
}
 

开发者ID:git03394538,
项目名称:lombok-ianchiu,
代码行数:8,
代码来源:PatchDelegate.java

示例10: getForEachComponentType

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private static TypeBinding getForEachComponentType(Expression collection, BlockScope scope) {
	if (collection != null) {
		TypeBinding resolved = collection.resolvedType;
		if (resolved == null) resolved = resolveForExpression(collection, scope);
		if (resolved == null) return null;
		if (resolved.isArrayType()) {
			resolved = ((ArrayBinding) resolved).elementsType();
			return resolved;
		} else if (resolved instanceof ReferenceBinding) {
			ReferenceBinding iterableType = ((ReferenceBinding)resolved).findSuperTypeOriginatingFrom(TypeIds.T_JavaLangIterable, false);
			
			TypeBinding[] arguments = null;
			if (iterableType != null) switch (iterableType.kind()) {
				case Binding.GENERIC_TYPE : // for (T t : Iterable<T>) - in case used inside Iterable itself
					arguments = iterableType.typeVariables();
					break;
				case Binding.PARAMETERIZED_TYPE : // for(E e : Iterable<E>)
					arguments = ((ParameterizedTypeBinding)iterableType).arguments;
					break;
				case Binding.RAW_TYPE : // for(Object e : Iterable)
					return null;
			}
			
			if (arguments != null && arguments.length == 1) {
				return arguments[0];
			}
		}
	}
	
	return null;
}
 

开发者ID:git03394538,
项目名称:lombok-ianchiu,
代码行数:32,
代码来源:PatchVal.java

示例11: getForEachComponentType

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private static TypeBinding getForEachComponentType(Expression collection, BlockScope scope) {
	if (collection != null) {
		TypeBinding resolved = collection.resolvedType;
		if (resolved == null) resolved = collection.resolveType(scope);
		if (resolved == null) return null;
		if (resolved.isArrayType()) {
			resolved = ((ArrayBinding) resolved).elementsType();
			return resolved;
		} else if (resolved instanceof ReferenceBinding) {
			ReferenceBinding iterableType = ((ReferenceBinding)resolved).findSuperTypeOriginatingFrom(TypeIds.T_JavaLangIterable, false);
			
			TypeBinding[] arguments = null;
			if (iterableType != null) switch (iterableType.kind()) {
				case Binding.GENERIC_TYPE : // for (T t : Iterable<T>) - in case used inside Iterable itself
					arguments = iterableType.typeVariables();
					break;
				case Binding.PARAMETERIZED_TYPE : // for(E e : Iterable<E>)
					arguments = ((ParameterizedTypeBinding)iterableType).arguments;
					break;
				case Binding.RAW_TYPE : // for(Object e : Iterable)
					return null;
			}
			
			if (arguments != null && arguments.length == 1) {
				return arguments[0];
			}
		}
	}
	
	return null;
}
 

开发者ID:mobmead,
项目名称:EasyMPermission,
代码行数:32,
代码来源:PatchVal.java

示例12: newElement

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
/**
 * Create a new element that knows what kind it is even if the binding is unresolved.
 */
public Element newElement(Binding binding, ElementKind kindHint) {
	if (binding == null)
		return null;
	switch (binding.kind()) {
	case Binding.FIELD:
	case Binding.LOCAL:
	case Binding.VARIABLE:
		return new VariableElementImpl(_env, (VariableBinding) binding);
	case Binding.TYPE:
	case Binding.GENERIC_TYPE:
		ReferenceBinding referenceBinding = (ReferenceBinding)binding;
		if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {
			return new ErrorTypeElement(this._env, referenceBinding);
		}
		if (CharOperation.equals(referenceBinding.sourceName, TypeConstants.PACKAGE_INFO_NAME)) {
			return new PackageElementImpl(_env, referenceBinding.fPackage);
		}
		return new TypeElementImpl(_env, referenceBinding, kindHint);
	case Binding.METHOD:
		return new ExecutableElementImpl(_env, (MethodBinding)binding);
	case Binding.RAW_TYPE:
	case Binding.PARAMETERIZED_TYPE:
		return new TypeElementImpl(_env, ((ParameterizedTypeBinding)binding).genericType(), kindHint);
	case Binding.PACKAGE:
		return new PackageElementImpl(_env, (PackageBinding)binding);
	case Binding.TYPE_PARAMETER:
		return new TypeParameterElementImpl(_env, (TypeVariableBinding)binding);
		// TODO: fill in the rest of these
	case Binding.IMPORT:
	case Binding.ARRAY_TYPE:
	case Binding.BASE_TYPE:
	case Binding.WILDCARD_TYPE:
	case Binding.INTERSECTION_TYPE:
		throw new UnsupportedOperationException("NYI: binding type " + binding.kind()); //$NON-NLS-1$
	}
	return null;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:41,
代码来源:Factory.java

示例13: isFromSource

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public boolean isFromSource() {
	if (isClass() || isInterface() || isEnum()) {
		ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
		if (referenceBinding.isRawType()) {
			return !((RawTypeBinding) referenceBinding).genericType().isBinaryBinding();
		} else if (referenceBinding.isParameterizedType()) {
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) referenceBinding;
			org.eclipse.jdt.internal.compiler.lookup.TypeBinding erasure = parameterizedTypeBinding.erasure();
			if (erasure instanceof ReferenceBinding) {
				return !((ReferenceBinding) erasure).isBinaryBinding();
			}
			return false;
		} else {
			return !referenceBinding.isBinaryBinding();
		}
	} else if (isTypeVariable()) {
		final TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
		final Binding declaringElement = typeVariableBinding.declaringElement;
		if (declaringElement instanceof MethodBinding) {
			MethodBinding methodBinding = (MethodBinding) declaringElement;
			return !methodBinding.declaringClass.isBinaryBinding();
		} else {
			final org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = (org.eclipse.jdt.internal.compiler.lookup.TypeBinding) declaringElement;
			if (typeBinding instanceof ReferenceBinding) {
				return !((ReferenceBinding) typeBinding).isBinaryBinding();
			} else if (typeBinding instanceof ArrayBinding) {
				final ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
				final org.eclipse.jdt.internal.compiler.lookup.TypeBinding leafComponentType = arrayBinding.leafComponentType;
				if (leafComponentType instanceof ReferenceBinding) {
					return !((ReferenceBinding) leafComponentType).isBinaryBinding();
				}
			}
		}

	} else if (isCapture()) {
		CaptureBinding captureBinding = (CaptureBinding) this.binding;
		return !captureBinding.sourceType.isBinaryBinding();
	}
	return false;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:41,
代码来源:TypeBinding.java

示例14: findGroundTargetType

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private ReferenceBinding findGroundTargetType(BlockScope blockScope, ReferenceBinding targetType, boolean argumentTypesElided) {
	if (!targetType.isValidBinding())
		return null;
	ParameterizedTypeBinding withWildCards = InferenceContext18.parameterizedWithWildcard(targetType);
	if (withWildCards != null) {
		if (!argumentTypesElided)
			return new InferenceContext18(blockScope).inferFunctionalInterfaceParameterization(this, blockScope, withWildCards);
		else
			return findGroundTargetTypeForElidedLambda(blockScope, withWildCards);
	}
	return targetType;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:13,
代码来源:LambdaExpression.java

示例15: findGroundTargetTypeForElidedLambda

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public ReferenceBinding findGroundTargetTypeForElidedLambda(BlockScope blockScope, ParameterizedTypeBinding withWildCards) {
	// non-wildcard parameterization (9.8) of the target type
	TypeBinding[] types = withWildCards.getNonWildcardParameterization(blockScope);
	if (types == null)
		return null;
	ReferenceBinding genericType = withWildCards.genericType();
	return blockScope.environment().createParameterizedType(genericType, types, genericType.enclosingType());
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:9,
代码来源:LambdaExpression.java

示例16: newElement

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
/**
 * Create a new element that knows what kind it is even if the binding is unresolved.
 */
public Element newElement(Binding binding, ElementKind kindHint) {
	switch (binding.kind()) {
	case Binding.FIELD:
	case Binding.LOCAL:
	case Binding.VARIABLE:
		return new VariableElementImpl(_env, (VariableBinding) binding);
	case Binding.TYPE:
	case Binding.GENERIC_TYPE:
		ReferenceBinding referenceBinding = (ReferenceBinding)binding;
		if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {
			return new ErrorTypeElement(this._env, referenceBinding);
		}
		if (referenceBinding.sourceName == TypeConstants.PACKAGE_INFO_NAME) {
			return new PackageElementImpl(_env, referenceBinding.fPackage);
		}
		return new TypeElementImpl(_env, referenceBinding, kindHint);
	case Binding.METHOD:
		return new ExecutableElementImpl(_env, (MethodBinding)binding);
	case Binding.RAW_TYPE:
	case Binding.PARAMETERIZED_TYPE:
		return new TypeElementImpl(_env, ((ParameterizedTypeBinding)binding).genericType(), kindHint);
	case Binding.PACKAGE:
		return new PackageElementImpl(_env, (PackageBinding)binding);
	case Binding.TYPE_PARAMETER:
		return new TypeParameterElementImpl(_env, (TypeVariableBinding)binding);
		// TODO: fill in the rest of these
	case Binding.IMPORT:
	case Binding.ARRAY_TYPE:
	case Binding.BASE_TYPE:
	case Binding.WILDCARD_TYPE:
	case Binding.INTERSECTION_TYPE:
		throw new UnsupportedOperationException("NYI: binding type " + binding.kind()); //$NON-NLS-1$
	}
	return null;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion-Juno38,
代码行数:39,
代码来源:Factory.java

示例17: getAnnotations

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public IAnnotationBinding[] getAnnotations() {
	if (this.annotations != null) {
		return this.annotations;
	}
	org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding refType = null;
	if (this.binding instanceof ParameterizedTypeBinding) {
		refType = ((ParameterizedTypeBinding) this.binding).genericType();
	} else if (this.binding.isAnnotationType() || this.binding.isClass() || this.binding.isEnum() || this.binding.isInterface()) {
		refType = (org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding) this.binding;
	}
	if (refType != null) {
		org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] internalAnnotations = refType.getAnnotations();
		int length = internalAnnotations == null ? 0 : internalAnnotations.length;
		if (length != 0) {
			IAnnotationBinding[] tempAnnotations = new IAnnotationBinding[length];
			int convertedAnnotationCount = 0;
			for (int i = 0; i < length; i++) {
				org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding internalAnnotation = internalAnnotations[i];
				IAnnotationBinding annotationInstance = this.resolver.getAnnotationInstance(internalAnnotation);
				if (annotationInstance == null) {
					continue;
				}
				tempAnnotations[convertedAnnotationCount++] = annotationInstance;
			}
			if (convertedAnnotationCount != length) {
				if (convertedAnnotationCount == 0) {
					return this.annotations = AnnotationBinding.NoAnnotations;
				}
				System.arraycopy(tempAnnotations, 0, (tempAnnotations = new IAnnotationBinding[convertedAnnotationCount]), 0, convertedAnnotationCount);
			}
			return this.annotations = tempAnnotations;
		}
	}
	return this.annotations = AnnotationBinding.NoAnnotations;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion-Juno38,
代码行数:36,
代码来源:TypeBinding.java

示例18: addAllMethodBindings0

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private static void addAllMethodBindings0(List<BindingTuple> list, TypeBinding binding, Set<String> banList, char[] fieldName, ASTNode responsible) throws DelegateRecursion {
	if (binding instanceof SourceTypeBinding) ((SourceTypeBinding) binding).scope.environment().globalOptions.storeAnnotations = true;
	if (binding == null) return;
	
	TypeBinding inner;
	
	if (binding instanceof ParameterizedTypeBinding) {
		inner = ((ParameterizedTypeBinding) binding).genericType();
	} else {
		inner = binding;
	}
	
	if (inner instanceof SourceTypeBinding) {
		ClassScope cs = ((SourceTypeBinding)inner).scope;
		if (cs != null) {
			try {
				Reflection.classScopeBuildFieldsAndMethodsMethod.invoke(cs);
			} catch (Exception e) {
				// See 'Reflection' class for why we ignore this exception.
			}
		}
	}
	
	if (binding instanceof ReferenceBinding) {
		ReferenceBinding rb = (ReferenceBinding) binding;
		MethodBinding[] availableMethods = rb.availableMethods();
		FieldBinding[] availableFields = rb.availableFields();
		failIfContainsAnnotation(binding, availableMethods); 
		failIfContainsAnnotation(binding, availableFields); 
		
		MethodBinding[] parameterizedSigs = availableMethods;
		MethodBinding[] baseSigs = parameterizedSigs;
		if (binding instanceof ParameterizedTypeBinding) {
			baseSigs = ((ParameterizedTypeBinding)binding).genericType().availableMethods();
			if (baseSigs.length != parameterizedSigs.length) {
				// The last known state of eclipse source says this can't happen, so we rely on it,
				// but if this invariant is broken, better to go with 'arg0' naming instead of crashing.
				baseSigs = parameterizedSigs;
			}
		}
		for (int i = 0; i < parameterizedSigs.length; i++) {
			MethodBinding mb = parameterizedSigs[i];
			String sig = printSig(mb);
			if (mb.isStatic()) continue;
			if (mb.isBridge()) continue;
			if (mb.isConstructor()) continue;
			if (mb.isDefaultAbstract()) continue;
			if (!mb.isPublic()) continue;
			if (mb.isSynthetic()) continue;
			if (!banList.add(sig)) continue; // If add returns false, it was already in there.
			BindingTuple pair = new BindingTuple(mb, baseSigs[i], fieldName, responsible);
			list.add(pair);
		}
		addAllMethodBindings0(list, rb.superclass(), banList, fieldName, responsible);
		ReferenceBinding[] interfaces = rb.superInterfaces();
		if (interfaces != null) {
			for (ReferenceBinding iface : interfaces) addAllMethodBindings0(list, iface, banList, fieldName, responsible);
		}
	}
}
 

开发者ID:git03394538,
项目名称:lombok-ianchiu,
代码行数:61,
代码来源:PatchDelegate.java

示例19: searchVisibleMethods

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private void searchVisibleMethods(
		ReferenceBinding receiverType,
		Scope scope,
		InvocationSite invocationSite,
		Scope invocationScope,
		boolean onlyStaticMethods,
		boolean notInJavadoc,
		ObjectVector methodsFound) {
	ReferenceBinding currentType = receiverType;
	if (notInJavadoc) {
		if (receiverType.isInterface()) {
			searchVisibleInterfaceMethods(
					new ReferenceBinding[]{currentType},
					receiverType,
					scope,
					invocationSite,
					invocationScope,
					onlyStaticMethods,
					methodsFound);

			currentType = scope.getJavaLangObject();
		}
	}
	boolean hasPotentialDefaultAbstractMethods = true;
	while (currentType != null) {

		MethodBinding[] methods = currentType.availableMethods();
		if (methods != null) {
			searchVisibleLocalMethods(
					methods,
					receiverType,
					scope,
					invocationSite,
					invocationScope,
					onlyStaticMethods,
					methodsFound);
		}

		if (notInJavadoc &&
				hasPotentialDefaultAbstractMethods &&
				(currentType.isAbstract() ||
						currentType.isTypeVariable() ||
						currentType.isIntersectionType() ||
						currentType.isEnum())){

			ReferenceBinding[] superInterfaces = currentType.superInterfaces();
			if (superInterfaces != null && currentType.isIntersectionType()) {
				for (int i = 0; i < superInterfaces.length; i++) {
					superInterfaces[i] = (ReferenceBinding)superInterfaces[i].capture(invocationScope, invocationSite.sourceEnd());
				}
			}

			searchVisibleInterfaceMethods(
					superInterfaces,
					receiverType,
					scope,
					invocationSite,
					invocationScope,
					onlyStaticMethods,
					methodsFound);
		} else {
			hasPotentialDefaultAbstractMethods = false;
		}
		if(currentType.isParameterizedType()) {
			currentType = ((ParameterizedTypeBinding)currentType).genericType().superclass();
		} else {
			currentType = currentType.superclass();
		}
	}
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:71,
代码来源:InternalExtendedCompletionContext.java

示例20: getTypeDeclaration

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public ITypeBinding getTypeDeclaration() {
	if (this.binding instanceof ParameterizedTypeBinding)
		return this.resolver.getTypeBinding(((ParameterizedTypeBinding)this.binding).genericType());
	return this.resolver.getTypeBinding(this.binding.unannotated());
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:6,
代码来源:TypeBinding.java

示例21: getName

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public String getName() {
	StringBuffer buffer;
	switch (this.binding.kind()) {

		case Binding.WILDCARD_TYPE :
		case Binding.INTERSECTION_TYPE:
			WildcardBinding wildcardBinding = (WildcardBinding) this.binding;
			buffer = new StringBuffer();
			buffer.append(TypeConstants.WILDCARD_NAME);
			if (wildcardBinding.bound != null) {
				switch(wildcardBinding.boundKind) {
			        case Wildcard.SUPER :
			        	buffer.append(TypeConstants.WILDCARD_SUPER);
			            break;
			        case Wildcard.EXTENDS :
			        	buffer.append(TypeConstants.WILDCARD_EXTENDS);
				}
				buffer.append(getBound().getName());
			}
			return String.valueOf(buffer);

		case Binding.TYPE_PARAMETER :
			if (isCapture()) {
				return NO_NAME;
			}
			TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
			return new String(typeVariableBinding.sourceName);

		case Binding.PARAMETERIZED_TYPE :
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) this.binding;
			buffer = new StringBuffer();
			buffer.append(parameterizedTypeBinding.sourceName());
			ITypeBinding[] tArguments = getTypeArguments();
			final int typeArgumentsLength = tArguments.length;
			if (typeArgumentsLength != 0) {
				buffer.append('<');
				for (int i = 0; i < typeArgumentsLength; i++) {
					if (i > 0) {
						buffer.append(',');
					}
					buffer.append(tArguments[i].getName());
				}
				buffer.append('>');
			}
			return String.valueOf(buffer);

		case Binding.RAW_TYPE :
			return getTypeDeclaration().getName();

		case Binding.ARRAY_TYPE :
			ITypeBinding elementType = getElementType();
			if (elementType.isLocal() || elementType.isAnonymous() || elementType.isCapture()) {
				return NO_NAME;
			}
			int dimensions = getDimensions();
			char[] brackets = new char[dimensions * 2];
			for (int i = dimensions * 2 - 1; i >= 0; i -= 2) {
				brackets[i] = ']';
				brackets[i - 1] = '[';
			}
			buffer = new StringBuffer(elementType.getName());
			buffer.append(brackets);
			return String.valueOf(buffer);

		default :
			if (isPrimitive() || isNullType()) {
				BaseTypeBinding baseTypeBinding = (BaseTypeBinding) this.binding;
				return new String(baseTypeBinding.simpleName);
			}
			if (isAnonymous()) {
				return NO_NAME;
			}
			return new String(this.binding.sourceName());
	}
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:76,
代码来源:TypeBinding.java

示例22: visit

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public boolean visit(ParameterizedTypeBinding parameterizedTypeBinding) {
	checkVisibility(parameterizedTypeBinding);
	return true;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:5,
代码来源:FunctionalExpression.java

示例23: recordNestedType

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的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);
	}
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:66,
代码来源:Util.java

示例24: isNodeResolvingTo

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
/**
 * Returns <code>true</code> if the type or one of its supertypes of a given {@link ASTNode} resolves to a given type signature.
 * <br/>
 * Examples:
 * <br/>
 * <code>
 * <br/>
 * isNodeResolvingTo(node of type java.lang.String, "java.lang.Object") returns true<br/>
 * isNodeResolvingTo(node of type java.lang.String, "java.lang.Iterable") returns false<br/>
 * </code>
 * 
 * TODO Implement this method without using the recursive helper method if there are any performance/stackoverflow issues
 * 
 * @param node an ASTNode
 * @param signature a fully qualified type
 * @return true if the type of the given ASTNode itself or one of its superclass/superinterfaces resolves to the given signature. false otherwise.
 */
protected boolean isNodeResolvingTo(ASTNode node, String signature) {
	if (signature == null || signature.trim().length() == 0) {
		return true;
	}
	Binding b = resolveNodeToBinding(node);
	if (b instanceof ParameterizedTypeBinding) {
		ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) b;
		return resolvesReferenceBindingTo(ptb.actualType(), signature);
	} else if (b instanceof BaseTypeBinding) {
		return (new String(b.readableName()).equals(signature));
	} else if (b instanceof TypeBinding) {
		return resolvesReferenceBindingTo((TypeBinding) b, signature);
	}
	
	return true;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:34,
代码来源:JavaStatementPostfixContext.java

示例25: getTypeDeclaration

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
public ITypeBinding getTypeDeclaration() {
	if (this.binding instanceof ParameterizedTypeBinding)
		return this.resolver.getTypeBinding(((ParameterizedTypeBinding)this.binding).genericType());
	return this;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion-Juno38,
代码行数:6,
代码来源:TypeBinding.java

示例26: addAllMethodBindings0

点赞 2

import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; //导入依赖的package包/类
private static void addAllMethodBindings0(List<BindingTuple> list, TypeBinding binding, Set<String> banList, char[] fieldName, ASTNode responsible) {
	if (binding == null) return;
	
	TypeBinding inner;
	
	if (binding instanceof ParameterizedTypeBinding) {
		inner = ((ParameterizedTypeBinding) binding).genericType();
	} else {
		inner = binding;
	}
	
	if (inner instanceof SourceTypeBinding) {
		ClassScope cs = ((SourceTypeBinding)inner).scope;
		if (cs != null) {
			try {
				Reflection.classScopeBuildFieldsAndMethodsMethod.invoke(cs);
			} catch (Exception e) {
				// See 'Reflection' class for why we ignore this exception.
			}
		}
	}
	
	if (binding instanceof ReferenceBinding) {
		ReferenceBinding rb = (ReferenceBinding) binding;
		MethodBinding[] parameterizedSigs = rb.availableMethods();
		MethodBinding[] baseSigs = parameterizedSigs;
		if (binding instanceof ParameterizedTypeBinding) {
			baseSigs = ((ParameterizedTypeBinding)binding).genericType().availableMethods();
			if (baseSigs.length != parameterizedSigs.length) {
				// The last known state of eclipse source says this can't happen, so we rely on it,
				// but if this invariant is broken, better to go with 'arg0' naming instead of crashing.
				baseSigs = parameterizedSigs;
			}
		}
		for (int i = 0; i < parameterizedSigs.length; i++) {
			MethodBinding mb = parameterizedSigs[i];
			String sig = printSig(mb);
			if (mb.isStatic()) continue;
			if (mb.isBridge()) continue;
			if (mb.isConstructor()) continue;
			if (mb.isDefaultAbstract()) continue;
			if (!mb.isPublic()) continue;
			if (mb.isSynthetic()) continue;
			if (!banList.add(sig)) continue; // If add returns false, it was already in there.
			BindingTuple pair = new BindingTuple(mb, baseSigs[i], fieldName, responsible);
			list.add(pair);
		}
		addAllMethodBindings0(list, rb.superclass(), banList, fieldName, responsible);
		ReferenceBinding[] interfaces = rb.superInterfaces();
		if (interfaces != null) {
			for (ReferenceBinding iface : interfaces) addAllMethodBindings0(list, iface, banList, fieldName, responsible);
		}
	}
}
 

开发者ID:redundent,
项目名称:lombok,
代码行数:55,
代码来源:PatchDelegate.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)