users@jaxb.java.net

jaxb2-commons value-constructor generate two no-arg constructors

From: Pierre Buyle <pierre.buyle_at_irislink.com>
Date: Mon, 26 Nov 2007 07:46:36 -0800 (PST)

When I generate a class from an empty complexType using the jaxb:serializable
customization and the value-constructor plugin , two no-arg constructors are
generated.

I quickly looked at the plugin code and found the bug. The value constructor
is generated if one of the thisFields and superFields collections are not
empty. These collections contains static fields, for which no constructor
parameters are generated. Since the jxb:serializable customization add the
static serialVersionUID field, thisFields is not empty. But as no
constructor is generated for this field, the value constructor become a dupe
of the no-arg constructor.

The fix is to filter static fields out from both collections before testing
if a value constructor is needed.
-- 
View this message in context: http://www.nabble.com/jaxb2-commons-value-constructor-generate-two-no-arg-constructors-tf4875842.html#a13951902
Sent from the java.net - jaxb users mailing list archive at Nabble.com.