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


Java MethodBinding.isSynthetic方法代码示例

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


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

示例1: resolveType

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
	TypeBinding type = super.resolveType(scope);
	if (type instanceof PolyTypeBinding)
		return type;
	MethodBinding method = getMethodBinding();
	if (method != null && method.isValidBinding() && !method.isSynthetic())
		throw new SelectionNodeFound(this.actualMethodBinding);
	throw new SelectionNodeFound();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:SelectionOnReferenceExpressionName.java

示例2: addAllMethodBindings0

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

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
/**
 * Add the members of a type to the maps of subtypes, fields, and methods.  Add only those
 * which are non-private and which are not overridden by an already-discovered member.
 * For fields, add them all; javac implementation does not take field hiding into account.
 * @param binding the type whose members will be added to the lists
 * @param ignoreVisibility if true, all members will be added regardless of whether they
 * are private, overridden, etc.
 * @param types a map of type simple name to type binding
 * @param fields a list of field bindings
 * @param methods a map of method simple name to set of method bindings with that name
 */
private void addMembers(ReferenceBinding binding, boolean ignoreVisibility, Map<String, ReferenceBinding> types,
		List<FieldBinding> fields, Map<String, Set<MethodBinding>> methods)
{
	for (ReferenceBinding subtype : binding.memberTypes()) {
		if (ignoreVisibility || !subtype.isPrivate()) {
			String name = new String(subtype.sourceName());
			if (null == types.get(name)) {
				types.put(name, subtype);
			}
		}
	}
	for (FieldBinding field : binding.fields()) {
		if (ignoreVisibility || !field.isPrivate()) {
			fields.add(field);
		}
	}
	for (MethodBinding method : binding.methods()) {
		if (!method.isSynthetic() && (ignoreVisibility || (!method.isPrivate() && !method.isConstructor()))) {
			String methodName = new String(method.selector);
			Set<MethodBinding> sameNamedMethods = methods.get(methodName);
			if (null == sameNamedMethods) {
				// New method name.  Create a set for it and add it to the list.
				// We don't expect many methods with same name, so only 4 slots:
				sameNamedMethods = new HashSet<MethodBinding>(4);
				methods.put(methodName, sameNamedMethods);
				sameNamedMethods.add(method);
			}
			else {
				// We already have a method with this name.  Is this method overridden?
				boolean unique = true;
				if (!ignoreVisibility) {
					for (MethodBinding existing : sameNamedMethods) {
						MethodVerifier verifier = _env.getLookupEnvironment().methodVerifier();
						if (verifier.doesMethodOverride(existing, method)) {
							unique = false;
							break;
						}
					}
				}
				if (unique) {
					sameNamedMethods.add(method);
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:58,代码来源:ElementsImpl.java

示例4: searchVisibleLocalMethods

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
private void searchVisibleLocalMethods(
		MethodBinding[] methods,
		ReferenceBinding receiverType,
		Scope scope,
		InvocationSite invocationSite,
		Scope invocationScope,
		boolean onlyStaticMethods,
		ObjectVector methodsFound) {
	ObjectVector newMethodsFound =  new ObjectVector();
	// Inherited methods which are hidden by subclasses are filtered out
	// No visibility checks can be performed without the scope & invocationSite

	next : for (int f = methods.length; --f >= 0;) {
		MethodBinding method = methods[f];

		if (method.isSynthetic()) continue next;

		if (method.isDefaultAbstract())	continue next;

		if (method.isConstructor()) continue next;

		if (onlyStaticMethods && !method.isStatic()) continue next;

		if (!method.canBeSeenBy(receiverType, invocationSite, scope)) continue next;

		for (int i = methodsFound.size; --i >= 0;) {
			MethodBinding otherMethod = (MethodBinding) methodsFound.elementAt(i);
			if (method == otherMethod)
				continue next;

			if (CharOperation.equals(method.selector, otherMethod.selector, true)) {
				if (this.lookupEnvironment.methodVerifier().isMethodSubsignature(otherMethod, method)) {
					continue next;
				}
			}
		}

		newMethodsFound.add(method);
	}

	methodsFound.addAll(newMethodsFound);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:InternalExtendedCompletionContext.java

示例5: generateMethodInfoAttributes

import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
/**
 * INTERNAL USE-ONLY
 * That method generates the attributes of a code attribute.
 * They could be:
 * - an exception attribute for each try/catch found inside the method
 * - a deprecated attribute
 * - a synthetic attribute for synthetic access methods
 *
 * It returns the number of attributes created for the code attribute.
 *
 * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding
 * @return <CODE>int</CODE>
 */
public int generateMethodInfoAttributes(MethodBinding methodBinding) {
	// leave two bytes for the attribute_number
	this.contentsOffset += 2;
	if (this.contentsOffset + 2 >= this.contents.length) {
		resizeContents(2);
	}
	// now we can handle all the attribute for that method info:
	// it could be:
	// - a CodeAttribute
	// - a ExceptionAttribute
	// - a DeprecatedAttribute
	// - a SyntheticAttribute

	// Exception attribute
	ReferenceBinding[] thrownsExceptions;
	int attributesNumber = 0;
	if ((thrownsExceptions = methodBinding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
		// The method has a throw clause. So we need to add an exception attribute
		// check that there is enough space to write all the bytes for the exception attribute
		attributesNumber += generateExceptionsAttribute(thrownsExceptions);
	}
	if (methodBinding.isDeprecated()) {
		// Deprecated attribute
		attributesNumber += generateDeprecatedAttribute();
	}
	if (this.targetJDK < ClassFileConstants.JDK1_5) {
		if (methodBinding.isSynthetic()) {
			attributesNumber += generateSyntheticAttribute();
		}
		if (methodBinding.isVarargs()) {
			attributesNumber += generateVarargsAttribute();
		}
	}
	// add signature attribute
	char[] genericSignature = methodBinding.genericSignature();
	if (genericSignature != null) {
		attributesNumber += generateSignatureAttribute(genericSignature);
	}
	if (this.targetJDK >= ClassFileConstants.JDK1_4) {
		AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
		if (methodDeclaration != null) {
			Annotation[] annotations = methodDeclaration.annotations;
			if (annotations != null) {
				attributesNumber += generateRuntimeAnnotations(annotations);
			}
			if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) {
				Argument[] arguments = methodDeclaration.arguments;
				if (arguments != null) {
					attributesNumber += generateRuntimeAnnotationsForParameters(arguments);
				}
			}
		}
	}
	if ((methodBinding.tagBits & TagBits.HasMissingType) != 0) {
		this.missingTypes = methodBinding.collectMissingTypes(this.missingTypes);
	}
	return attributesNumber;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:72,代码来源:ClassFile.java


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