Do you suggest to leave just one private constructor in StringResourceModel and use your I18N as inner static Builder instead ? Because otherwise if we leave the current constructors the problem would be still there.
I agree that it is cleaner with the builder pattern. It would be a bit inconsistent because we don't use builder pattern anywhere else. All **Choice classes would benefit too, I guess. Additionally the builder pattern makes it a bit harder to extend a class. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Sep 23, 2014 at 4:10 PM, Martijn Dashorst < [email protected]> wrote: > See my comment at WICKET-5702 (I accidentally put it in 4972 too). I'd > rather construct a better API in the first place... > > Martijn > > On Tue, Sep 23, 2014 at 2:42 PM, Martin Grigorov <[email protected]> > wrote: > > Hi, > > > > https://issues.apache.org/jira/browse/WICKET-5702 hit a problem with > > StringResourceModel that we uses Object... as a last parameter in its > > constructors. > > > > I think that using Object... is evil, especially when there is an > > overloaded method/constructor that "looks like" the other one. > > For example: > > > > MyObject(String p1, Object... extra) > > MyObject(String p1, Integer p2, Object... extra) > > > > If a developer wants to pass p2 as an extra then (s)he has to be really > > careful. > > > > In https://issues.apache.org/jira/browse/WICKET-4972 I have suggested to > > use Object[] instead, but later when I worked on it for 7.0.0-M1 I have > > forgotten to change it. > > > > By using Object[] the developer has to type some more but it is much > easier > > to reason about. > > > > Any objections to make the change for 7.0.0-M4 ? > > > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com >
