2 Replies Latest reply on Nov 5, 2008 10:05 AM by Ales Justin

    BeanMetaDataBuilder.createArray() surprise...

    David Lloyd Master

      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. :-)