当前位置: 首页>>代码示例>>Java>>正文


Java ReferenceBinding.availableMethods方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableMethods方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.availableMethods方法的具体用法?Java ReferenceBinding.availableMethods怎么用?Java ReferenceBinding.availableMethods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding的用法示例。


在下文中一共展示了ReferenceBinding.availableMethods方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllMemberValuePairs

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public IMemberValuePairBinding[] getAllMemberValuePairs() {
	IMemberValuePairBinding[] pairs = getDeclaredMemberValuePairs();
	ReferenceBinding typeBinding = this.binding.getAnnotationType();
	if (typeBinding == null || ((typeBinding.tagBits & TagBits.HasMissingType) != 0)) return pairs;
	MethodBinding[] methods = typeBinding.availableMethods(); // resilience
	int methodLength = methods == null ? 0 : methods.length;
	if (methodLength == 0) return pairs;

	int declaredLength = pairs.length;
	if (declaredLength == methodLength)
		return pairs;

	HashtableOfObject table = new HashtableOfObject(declaredLength);
	for (int i = 0; i < declaredLength; i++) {
		char[] internalName = ((MemberValuePairBinding) pairs[i]).internalName();
		if (internalName == null) continue;
		table.put(internalName, pairs[i]);
	}

	// handle case of more methods than declared members
	IMemberValuePairBinding[] allPairs = new  IMemberValuePairBinding[methodLength];
	for (int i = 0; i < methodLength; i++) {
		Object pair = table.get(methods[i].selector);
		allPairs[i] = pair == null ? new DefaultValuePairBinding(methods[i], this.bindingResolver) : (IMemberValuePairBinding) pair;
	}
	return allPairs;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:AnnotationBinding.java

示例2: addAllMethodBindings0

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的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

示例3: searchVisibleInterfaceMethods

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleInterfaceMethods(
		ReferenceBinding[] itsInterfaces,
		ReferenceBinding receiverType,
		Scope scope,
		InvocationSite invocationSite,
		Scope invocationScope,
		boolean onlyStaticMethods,
		ObjectVector methodsFound) {
	if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
		ReferenceBinding[] interfacesToVisit = itsInterfaces;
		int nextPosition = interfacesToVisit.length;

		for (int i = 0; i < nextPosition; i++) {
			ReferenceBinding currentType = interfacesToVisit[i];
			MethodBinding[] methods = currentType.availableMethods();
			if(methods != null) {
				searchVisibleLocalMethods(
						methods,
						receiverType,
						scope,
						invocationSite,
						invocationScope,
						onlyStaticMethods,
						methodsFound);
			}

			itsInterfaces = currentType.superInterfaces();
			if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
				int itsLength = itsInterfaces.length;
				if (nextPosition + itsLength >= interfacesToVisit.length)
					System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
				nextInterface : for (int a = 0; a < itsLength; a++) {
					ReferenceBinding next = itsInterfaces[a];
					for (int b = 0; b < nextPosition; b++)
						if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface;
					interfacesToVisit[nextPosition++] = next;
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:42,代码来源:InternalExtendedCompletionContext.java

示例4: searchVisibleMethods

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的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

示例5: getDeclaredMethods

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public synchronized IMethodBinding[] getDeclaredMethods() {
	if (this.prototype != null) {
		return this.prototype.getDeclaredMethods();
	}
	if (this.methods != null) {
		return this.methods;
	}
	try {
		if (isClass() || isInterface() || isEnum()) {
			ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
			org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] internalMethods = referenceBinding.availableMethods(); // be resilient
			int length = internalMethods.length;
			if (length != 0) {
				int convertedMethodCount = 0;
				IMethodBinding[] newMethods = new IMethodBinding[length];
				for (int i = 0; i < length; i++) {
					org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = internalMethods[i];
					if (methodBinding.isDefaultAbstract() || methodBinding.isSynthetic() || (methodBinding.isConstructor() && isInterface())) {
						continue;
					}
					IMethodBinding methodBinding2 = this.resolver.getMethodBinding(methodBinding);
					if (methodBinding2 != null) {
						newMethods[convertedMethodCount++] = methodBinding2;
					}
				}
				if (convertedMethodCount != length) {
					if (convertedMethodCount == 0) {
						return this.methods = NO_METHOD_BINDINGS;
					}
					System.arraycopy(newMethods, 0, (newMethods = new IMethodBinding[convertedMethodCount]), 0, convertedMethodCount);
				}
				return this.methods = newMethods;
			}
		}
	} catch (RuntimeException e) {
		/* in case a method cannot be resolvable due to missing jars on the classpath
		 * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
		 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
		 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
		 */
		org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve declared methods"); //$NON-NLS-1$
	}
	return this.methods = NO_METHOD_BINDINGS;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:TypeBinding.java

示例6: searchVisibleInterfaceMethods

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleInterfaceMethods(
		ReferenceBinding[] itsInterfaces,
		ReferenceBinding receiverType,
		Scope scope,
		InvocationSite invocationSite,
		Scope invocationScope,
		boolean onlyStaticMethods,
		ObjectVector methodsFound) {
	if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
		ReferenceBinding[] interfacesToVisit = itsInterfaces;
		int nextPosition = interfacesToVisit.length;

		for (int i = 0; i < nextPosition; i++) {
			ReferenceBinding currentType = interfacesToVisit[i];
			MethodBinding[] methods = currentType.availableMethods();
			if(methods != null) {
				searchVisibleLocalMethods(
						methods,
						receiverType,
						scope,
						invocationSite,
						invocationScope,
						onlyStaticMethods,
						methodsFound);
			}

			itsInterfaces = currentType.superInterfaces();
			if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
				int itsLength = itsInterfaces.length;
				if (nextPosition + itsLength >= interfacesToVisit.length)
					System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
				nextInterface : for (int a = 0; a < itsLength; a++) {
					ReferenceBinding next = itsInterfaces[a];
					for (int b = 0; b < nextPosition; b++)
						if (next == interfacesToVisit[b]) continue nextInterface;
					interfacesToVisit[nextPosition++] = next;
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:42,代码来源:InternalExtendedCompletionContext.java

示例7: getDeclaredMethods

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public synchronized IMethodBinding[] getDeclaredMethods() {
	if (this.methods != null) {
		return this.methods;
	}
	try {
		if (isClass() || isInterface() || isEnum()) {
			ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
			org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] internalMethods = referenceBinding.availableMethods(); // be resilient
			int length = internalMethods.length;
			if (length != 0) {
				int convertedMethodCount = 0;
				IMethodBinding[] newMethods = new IMethodBinding[length];
				for (int i = 0; i < length; i++) {
					org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = internalMethods[i];
					if (methodBinding.isDefaultAbstract() || methodBinding.isSynthetic() || (methodBinding.isConstructor() && isInterface())) {
						continue;
					}
					IMethodBinding methodBinding2 = this.resolver.getMethodBinding(methodBinding);
					if (methodBinding2 != null) {
						newMethods[convertedMethodCount++] = methodBinding2;
					}
				}
				if (convertedMethodCount != length) {
					if (convertedMethodCount == 0) {
						return this.methods = NO_METHOD_BINDINGS;
					}
					System.arraycopy(newMethods, 0, (newMethods = new IMethodBinding[convertedMethodCount]), 0, convertedMethodCount);
				}
				return this.methods = newMethods;
			}
		}
	} catch (RuntimeException e) {
		/* in case a method cannot be resolvable due to missing jars on the classpath
		 * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
		 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
		 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
		 */
		org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve declared methods"); //$NON-NLS-1$
	}
	return this.methods = NO_METHOD_BINDINGS;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:42,代码来源:TypeBinding.java


注:本文中的org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。