In my opinion, type safety either is... or isn't... :)
I'm not entirely sure that selectively adding generics is the right
way to go, because it means that what should be two functionally
equivalent operations become different. For example,
SelectQuery(String, Expression) would differ from SelectQuery(String,
Expression). I'd definitely love to explore the possibility of
increasing the type safety, but I think its going to require a lot
more thought to get there, and at questionable value.
Cris
On 2/26/06, Todd O'Bryan <toddobrya..ac.com> wrote:
> I noticed the problem. However, there's a lot we could do. In
> particular, we could make a templated version of SelectQuery,
> especially to replace the version that is
>
> SelectQuery(Class, Expression)
>
> After using the template with..uppressWarnings, I only had to insert
> it myself in three places in code with tens of Cayenne db tables.
> That's pretty good type safety.
>
> Todd
>
> On Feb 26, 2006, at 10:40 AM, Cris Daniluk wrote:
>
> > On 2/26/06, Todd O'Bryan <toddobrya..ac.com> wrote:
> >> I found the template to include generics for to-many relationships in
> >> superclasses (posted by Chris Daniluk last year), but this still
> >> creates a warning because the cast from List to List<E> is unchecked.
> >> Is the best/easiest way to deal with that an annotation of
> >>..uppressWarnings("unchecked") on the method, and, if so, is there
> >> any reason that's not in the template?
> >
> >..uppressWarnings didn't exist when the template was created... it
> > probably should be there. In fact, in the somewhat similar version of
> > the template I use, it is :) Just the same though, there's a million
> > other places in Cayenne where you can't get rid of the warnings.
> >
> >> Also, I glanced through JIRA and didn't see anything about generics
> >> support. Is that on the horizon or is it more complicated than it
> >> seems to be?
> >
> > I'm not entirely sure its possible to have a 100% type-safe Cayenne.
> > Areas of particular concern are named queries (how to get the string
> > version of the query root to the compiler), the String-version of
> > performQuery and XML deserialization.
> >
> > The way generics were implemented (with erasure) doesn't render them
> > useless, but it does mean they can't be used everywhere. I'd love to
> > see that warning removed entirely in JDK6 but I'm not holding my
> > breath!
> >
> > Cris
>
>
This archive was generated by hypermail 2.0.0 : Sun Feb 26 2006 - 23:51:53 EST