[ https://issues.apache.org/activemq/browse/CAMEL-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53706#action_53706 ]
Adam Brewster edited comment on CAMEL-1922 at 8/21/09 10:05 PM: ---------------------------------------------------------------- I wrote a unit test (the gist was FromBeanTest.java + the description field of this issue), but apparently I suck at maven because can't get the test suite to run. Even after I checked out a fresh copy of the project, it still didn't work. Occasionally when `mvn test` decides not to complain that camel-core is missing (umm, didn't I just tell you to build that?) it takes ~ hours to finish (does it start a new JVM for every test?) and finally complains about DataSet being broken. I'm considering `rm -rf ~/.m2` but that seems pretty brutal. I heard a rumor that with -Dtest=BridgeMethodTest, maven would only run my new test, but given that option it reverts to complaining about camel-core. I'll try again at some point. was (Author: adambrewster): I wrote a unit test (the gist was FromBeanTest.java + the description field of this issue), but apparently I suck at maven because can't I the test suite to run. Even after I checked out a fresh copy of the project, it still didn't work. Occasionally when `mvn test` decides not to complain that camel-core is missing (umm, didn't I just tell you to build that?) it takes ~ hours to finish (does it start a new JVM for every test?) and finally complains about DataSet being broken. I'm considering `rm -rf ~/.m2` but that seems pretty brutal. I heard a rumor that with -Dtest=BridgeMethodTest, maven would only run my new test, but given that option it reverts to complaining about camel-core. I'll try again at some point. > 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.