[ https://issues.apache.org/jira/browse/WICKET-4041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102217#comment-13102217 ]
Craig P. Motlin commented on WICKET-4041: ----------------------------------------- That changes the return type. IModel<Collection<? extends MyDomainObject>> model = Model.of(MyApplication.get().getMyDomainObjects()); Besides the wildcard in the return type, it's no longer a Model<List>, which means it no longer works with a ListView. > In Model<T>, the type T should not extend Serializable. > ------------------------------------------------------- > > Key: WICKET-4041 > URL: https://issues.apache.org/jira/browse/WICKET-4041 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 1.5-RC7 > Reporter: Craig P. Motlin > Assignee: Igor Vaynberg > > The problem is that lots of common interfaces (like List) don't implement > Serializable even though most/all of their subclasses are in fact > serializable. That means clients wind up with code containing potentially > unsafe casts like this. > Model<ArrayList<MyDomainObject>> listModel = new > Model<ArrayList<MyDomainObject>>() > { > @Override > public ArrayList<MyDomainObject> getObject() > { > return (ArrayList<MyDomainObject>) > DominionApplication.get().getMyDomainObjects(); > } > }; > It still makes sense for Model to check that the type is an instanceof > Serializable at runtime, but it's too much to enforce at compile time. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira