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 - 18:20:15 EST