/** * Check whether the given method corresponds to the container's currently invoked * factory method. Compares method name and parameter types only in order to work * around a potential problem with covariant return types (currently only known * to happen on Groovy classes). */ private boolean isCurrentlyInvokedFactoryMethod(Method method) { Method currentlyInvoked = SimpleInstantiationStrategy.getCurrentlyInvokedFactoryMethod(); return (currentlyInvoked != null && method.getName().equals(currentlyInvoked.getName()) && Arrays.equals(method.getParameterTypes(), currentlyInvoked.getParameterTypes())); }