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


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

        

Reply via email to