[ https://issues.apache.org/jira/browse/LANG-1657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved LANG-1657. ----------------------------------- Fix Version/s: 3.15.0 Resolution: Fixed > DiffBuilder: Type constraint for method append(..., DiffResult) too strict > -------------------------------------------------------------------------- > > Key: LANG-1657 > URL: https://issues.apache.org/jira/browse/LANG-1657 > Project: Commons Lang > Issue Type: Bug > Components: lang.builder.* > Affects Versions: 3.12.0 > Reporter: Matthias Welz > Priority: Major > Fix For: 3.15.0 > > > The DiffBuilder<T> has a method append which allows to append an existing > DiffResult for a property. The example illustrates this the following way: > > {code:java} > public class Person implements Diffable<Person> { > String name; > Address address; // implements Diffable<Address> > ... > public DiffResult diff(Person obj) { > return new DiffBuilder(this, obj, ToStringStyle.SHORT_PREFIX_STYLE) > .append("name", this.name, obj.name) > .append("address", this.address.diff(obj.address)) > .build(); > } > } > {code} > > However, the signature of the method was recently changed to: > {code:java} > public DiffBuilder<T> append(final String fieldName, final DiffResult<T> > diffResult) > {code} > As a consequence, the example code won't compile anymore when using generics > because the a _DiffBuilder<Person>_ will only accept _DiffResult<Person>_ but > not _DiffResult<Address>_ for its append method. > The signature should be: > {code:java} > public <O> DiffBuilder<T> append(final String fieldName, final DiffResult<O> > diffResult) > {code} > or: > {code:java} > public DiffBuilder<T> append(final String fieldName, final DiffResult<?> > diffResult) > {code} > instead. > -- This message was sent by Atlassian Jira (v8.20.10#820010)