users@jaxb.java.net

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

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Mon, 26 Nov 2007 18:38:55 +0000

Hi Pierre,

Thanks for reporting this. I've put a new version up which should fix
the issue.

https://jaxb2-commons.dev.java.net/value-constructor/


cheers
kenny


Pierre Buyle wrote:
> 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.