Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.jdt.internal.compiler.lookup;

Binding denoting a polymorphic method
public class PolymorphicMethodBinding extends MethodBinding {
	public PolymorphicMethodBinding(MethodBinding polymorphicMethodTypeBinding[] parameterTypes) {
		super(
				polymorphicMethod.modifiers,
				polymorphicMethod.selector,
				polymorphicMethod.returnType,
				parameterTypes,
				polymorphicMethod.thrownExceptions,
				polymorphicMethod.declaringClass);
		this. = polymorphicMethod;
		this. = polymorphicMethod.tagBits;
	}
	public PolymorphicMethodBinding(MethodBinding polymorphicMethodTypeBinding returnTypeTypeBinding[] parameterTypes) {
		super(
				polymorphicMethod.modifiers,
				polymorphicMethod.selector,
				returnType,
				parameterTypes,
				polymorphicMethod.thrownExceptions,
				polymorphicMethod.declaringClass);
		this. = polymorphicMethod;
		this. = polymorphicMethod.tagBits;
	}
	public MethodBinding original() {
		return this.;
	}
	public boolean isPolymorphic() {
		return true;
	}
	public boolean matches(TypeBinding[] matchingParametersTypeBinding matchingReturnType) {
		int cachedParametersLength = this. == null ? 0 : this..length;
		int matchingParametersLength = matchingParameters == null ? 0 : matchingParameters.length;
		if (matchingParametersLength != cachedParametersLength) {
			return false;
		}
		for (int j = 0; j < cachedParametersLengthj++){
			if (this.[j] != matchingParameters[j]) {
				return false;
			}
		}
		TypeBinding cachedReturnType = this.;
		if (matchingReturnType == null) {
			if (cachedReturnType != null) {
				return false;
			}
else if (cachedReturnType == null) {
			return false;
else if (matchingReturnType != cachedReturnType) {
			return false;
		}
		// all arguments match
		return true;
	}
	/*
	 * Even if polymorphic methods are varargs method, we don't want them to be treated as varargs method
	 */
	public boolean isVarargs() {
		return false;
	}
New to GrepCode? Check out our FAQ X