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(); }
/* * @see ITypeBinding#getDeclaredMethods() */ 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; }
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); }