[jboss-user] [Microcontainer] - BeanMetaDataBuilder.createArray() surprise...

david.lloyd@jboss.com do-not-reply at jboss.com
Wed Nov 5 00:59:00 EST 2008


BeanMetaDataBuilder.createArray() is defined to return a List.  If you are naive like me, you'll pass in this value to e.g. BeanMetaDataBuilder.addConstructorParameter().  This method is overloaded.  The BeanMetaDataBuilder.addConstructorParameter(Object) variant will pick it up and you'll end up with a deployment error.

The fix is to cast the List to ValueMetaData (because, lo and behold, the class which actually implements List is actually also a ValueMetaData as well) so that you get BeanMetaDataBuilder.addConstructorParameter(ValueMetaData) instead. This is a bit of a yucky API.  How about adding an interface ArrayValueMetaData extends List, ValueMetaData and return that instead?

Just a thought after some very confused debugging on my part. :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186884#4186884

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186884



More information about the jboss-user mailing list