You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by apara <ap...@standardset.com> on 2015/10/19 22:35:31 UTC

Possible bug with BeanInfo.introspect

Camel 2.15.3

I have the following structure:

public interface Handler {
    Data handle(Data data);
}

public class AbstractHandler implements Handler {

   public Data handle(Data data) {... implementation ...}
}

public class ConcreteHandler extends AbstractHandler {

     ... no specific overrides of handle ...
}

The introspection starts with ConcreteHandler, however, because
ConcreteHandler is a public class the following code inside of BeanInfo
(around line 344) adds all the interface methods as well:

       if (Modifier.isPublic(clazz.getModifiers())) {
            // add additional interface methods
            List<Method> extraMethods = getInterfaceMethods(clazz);
            for (Method target : extraMethods) {
                for (Method source : methods) {
                    if (ObjectHelper.isOverridingMethod(source, target,
false)) {
                        overrides.add(target);
                    }
                }
            }
            // remove all the overrides methods
            extraMethods.removeAll(overrides);
            methods.addAll(extraMethods);
        }

However, all the interface methods are "abstract".

The introspect continues to crawl up the tree when it actually finds the
implementation of method handle inside of AbstractHandler.  However, that
implementation is NOT added due to the following code (line 390 or so):

        MethodInfo existingMethodInfo = overridesExistingMethod(methodInfo);
        if (existingMethodInfo != null) {
            LOG.trace("This method is already overridden in a subclass, so
the method from the sub class is preferred: {}", existingMethodInfo);
            return existingMethodInfo;
        }

So, at the end BeanInfo.operationsWithBody winds up with only the abstract
handle method.  Unfortunately, with 2.15.3 the following block of code was
added:

        // remove all abstract methods
        removeAllAbstractMethods(localOperationsWithBody);
        removeAllAbstractMethods(localOperationsWithNoBody);
        removeAllAbstractMethods(localOperationsWithCustomAnnotation);
        removeAllAbstractMethods(localOperationsWithHandlerAnnotation);

So, the method I want invoked, is removed.

This does not manifest in 2.15.2







--
View this message in context: http://camel.465427.n5.nabble.com/Possible-bug-with-BeanInfo-introspect-tp5772875.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possible bug with BeanInfo.introspect in 2.15.3 version

Posted by apara <ap...@standardset.com>.
I have created issue https://issues.apache.org/jira/browse/CAMEL-9243 with
some test code to demonstrate this regression in 2.15.3.



--
View this message in context: http://camel.465427.n5.nabble.com/Possible-bug-with-BeanInfo-introspect-in-2-15-3-version-tp5772875p5772977.html
Sent from the Camel - Users mailing list archive at Nabble.com.