-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Labels
Description
With the goal xpp3-reader
the set method of the bean is called before the collection has been populated. For example the following pattern is generated:
java.util.List<MojoDescriptor> mojos = new java.util.ArrayList<MojoDescriptor>();
pluginDescriptor.setMojos( mojos );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "mojo".equals( parser.getName() ) )
{
mojos.add( parseMojoDescriptor( parser, strict ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
when using the following model:
<field xdoc.separator="blank">
<name>mojos</name>
<version>1.0.0+</version>
<association>
<type>MojoDescriptor</type>
<multiplicity>*</multiplicity>
</association>
<description>Description of each Mojo provided by the plugin.</description>
</field>
The code fails if the called setter method does not just add the reference to the collection but copies/processes the given argument.
Therefore the setter method should be called only after population (i.e. after the while loop).
The code is being generated in
Line 1639 in b405413
private void writeNewSetLocation( String key, String objectName, String trackerVariable, JSourceCode sc ) |