}
private void findFormalsForVariable(ClassInstanceCreation ctorCall)
throws JavaModelException, CoreException {
final int paramNumber = getParamNumber(ctorCall.arguments(), this.name);
IMethod meth = (IMethod) ctorCall.resolveConstructorBinding()
.getJavaElement();
if (meth == null && ctorCall.getAnonymousClassDeclaration() != null) {
// most likely an anonymous class.
final AnonymousClassDeclaration acd = ctorCall
.getAnonymousClassDeclaration();
final ITypeBinding binding = acd.resolveBinding();
final ITypeBinding superBinding = binding.getSuperclass();
for (final Iterator it = Arrays.asList(
superBinding.getDeclaredMethods()).iterator(); it.hasNext();) {
final IMethodBinding imb = (IMethodBinding) it.next();
if (imb.isConstructor()) {
final ITypeBinding[] itb = imb.getParameterTypes();
if (itb.length > paramNumber) {
final ITypeBinding ithParamType = itb[paramNumber];
if (ithParamType.isEqualTo(((Expression) ctorCall
.arguments().get(paramNumber))
.resolveTypeBinding())) {
meth = (IMethod) imb.getJavaElement();
break;
}
}
}
}
}
final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);
if (top == null)
throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
ctorCall);
else