[ https://issues.apache.org/activemq/browse/CAMEL-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53708#action_53708 ]
Hadrian Zbarcea commented on CAMEL-1922: ---------------------------------------- @Adam, Please follow Willem's instructions. A few comments: * mvn:test only *runs* the tests, it assumes the project is already built. If not you get the error you mentioned (so no, you did not tell it to build that, just test). mvn:install builds *and* tests. mvn:clean is sorta optional but needed sometimes when things get out of hands. The command you want is probably `mvn test -Dtest=BridgeMethodTest` * DataSet: there is an issue with the test (wrong order of consumer creation may lead to loss of messages on faster boxes). I fixed it in 2.0 but forgot to port it back to 1.x. My bad, will take care of it. Thanks for pointing this out. > BeanEndpoint fails in the presence of bridge methods > ---------------------------------------------------- > > Key: CAMEL-1922 > URL: https://issues.apache.org/activemq/browse/CAMEL-1922 > Project: Apache Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 1.6.1 > Environment: Java SE 5 > Reporter: Adam Brewster > Assignee: Hadrian Zbarcea > Attachments: > 0001-Reject-bridge-methods-while-introspecting-POJO-consu.patch > > Original Estimate: 2 days > Remaining Estimate: 2 days > > When a message is sent to a bean: endpoint, camel searches for a method with > the right signature. If multiple methods are found, an exception is thrown. > If a have an interface like > public interface <T> I { > T function(T arg); > } > and a class like > public class C implements I<Number> { > Number function(Number arg) { > return new Double(arg.doubleValue() * 2); > } > } > then I can't use an instance of C as an endpoint. > The problem is that under the hood java has created a bridge method, and the > "real" class C looks like > public class C implements I<Number> { > Number function(Number arg) { > return new Double(arg.doubleValue() * 2); > } > Object function(Object arg) { > return function((Number) arg); > } > } > Camel then discovers that there are two methods it could call (f(Object) and > f(Number)) and throws an exception even though there's no real ambiguity > because both methods do the same thing. > I recommend rejecting bridge methods in BeanInfo.isValidMethod with somehting > like > if (method.isBridgeMethod()) return false; > Does this sound reasonable? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.