Re: Generics

From: Cris Daniluk (cris.danilu..mail.com)
Date: Sun Feb 26 2006 - 10:40:30 EST

  • Next message: Todd O'Bryan: "Re: Generics"

    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?

    @SuppressWarnings 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 - 10:40:32 EST