spring-framework/org.springframework.context
Chris Beams 7b999c676f Introduce ReflectionUtils#getUniqueDeclaredMethods
This change is in support of certain polymorphism cases in
@Configuration class inheritance hierarchies.  Consider the following
scenario:

@Configuration
public abstract class AbstractConfig {
    public abstract Object bean();
}

@Configuration
public class ConcreteConfig {
    @Override
    @Bean
    public BeanPostProcessor bean() { ... }
}

ConcreteConfig overrides AbstractConfig's #bean() method with a
covariant return type, in this case returning an object of type
BeanPostProcessor.  It is critically important that the container
is able to detect the return type of ConcreteConfig#bean() in order
to instantiate the BPP at the right point in the lifecycle.

Prior to this change, the container could not do this.
AbstractAutowireCapableBeanFactory#getTypeForFactoryMethod called
ReflectionUtils#getAllDeclaredMethods, which returned Method objects
for both the Object and BeanPostProcessor signatures of the #bean()
method.  This confused the implementation sufficiently as not to
choose a type for the factory method at all.  This means that the
BPP never gets detected as a BPP.

The new method being introduced here, #getUniqueDeclaredMethods, takes
covariant return types into account, and filters out duplicates,
favoring the most specific / narrow return type.

Additionally, it filters out any CGLIB 'rewritten' methods, which
is important in the case of @Configuration classes, which are
enhanced by CGLIB.  See the implementation for further details.
2011-05-06 19:07:25 +00:00
..
.settings Merge 3.1.0 development branch into trunk 2010-10-25 19:48:20 +00:00
src Introduce ReflectionUtils#getUniqueDeclaredMethods 2011-05-06 19:07:25 +00:00
.classpath moved cache abstraction from context.support to context 2011-02-07 17:41:25 +00:00
.project SPR-6158: Initial implementation and tests for @ImportXml 2009-11-07 00:32:40 +00:00
.springBeans Remove "Feature" support introduced in 3.1 M1 2011-05-06 19:03:52 +00:00
build.xml + upgrade to AspectJ 1.6.8 2010-02-04 11:46:21 +00:00
context.iml moved cache abstraction from context.support to context 2011-02-07 17:41:25 +00:00
ivy.xml moved cache abstraction from context.support to context 2011-02-07 17:41:25 +00:00
pom.xml Sync pom.xml deps with ivy.xml changes since 3.0.5 2011-02-09 06:56:53 +00:00
template.mf SPR-6416, initial commit for the conversation management 2011-04-12 13:21:18 +00:00