Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.0.5
-
None
Description
Currently the component interceptor (the DefaultComponentManager) looks at only the parent interfaces and does not walk up the interface hierarchy. So if I have an enabler interface E, which is extended by an interface I which in turn is implemented by a class C, the components infrastructure will not instantiate the class C at the appropriate point when the declared enabler interface is E. The issue is most likely with the following code in DefaultComponentManager
---- Current Code ----
private void addAllInterfaces(Class clazz, List allInterfaces) {
if (clazz == null)
Class[] interfaces = clazz.getInterfaces();
allInterfaces.addAll(Arrays.asList(interfaces));
addAllInterfaces(clazz.getSuperclass(), allInterfaces);
}
What possibly needs to be done is (one may replace List by Set for optimization purposes)
— Suggested Code ----
private void addAllInterfaces(Class clazz, List allInterfaces) {
if (clazz == null) { return; }
Class[] interfaces = clazz.getInterfaces();
allInterfaces.addAll(Arrays.asList(interfaces));
addAllInterfaces(interfaces, allInterfaces);
addAllInterfaces(clazz.getSuperclass(), allInterfaces);
}
private void addAllInterfaces(Class[] clazzes, List allInterfaces) {
if (clazzes != null)
{
for(int i = 0 ; i < clazzes.length; i++)
}
}