You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2011/09/11 06:31:09 UTC
[jira] [Resolved] (WICKET-4041) In Model, the type T should not
extend Serializable.
[ https://issues.apache.org/jira/browse/WICKET-4041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-4041.
-----------------------------------
Resolution: Invalid
Assignee: Igor Vaynberg
for non-serializable things use LoadableDetachableModel<T>
for lists you actually want to store in session (which is what Model<T> does), use Model.of(List) which will auto-convert your list to an array list
> 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