Compile Errors

27 views
Skip to first unread message

Greg Mallett

unread,
Apr 21, 2012, 10:49:30 AM4/21/12
to ActiveJDBC Group
I've been getting strange compile errors in Eclipse 3.6. I was under
the impression, based on the Active JDBC docs & my understanding of
generics, that this would work without the need for casts:

final User user = User.findFirst("username=?", username);
List<UCLImage> images = UCLImage.findAll();
return UCLImage.findById(id).getImage();

UCLImage extends the Active JDBC Model class, so the above should work
with no casts! However, eclipse complains, either with a warning or
it just outright refuses to compile, requiring casts to get it to
work:

final User user = (User) User.findFirst("username=?", username);
@SupressWarnings("unchecked")
List<UCLImage> images = UCLImage.findAll();
return ((UCLImage)UCLImage.findById(id)).getImage();

Any ideas? I'm suspecting an Eclipse issue, but I don't know where to
start fixing it.

ipolevoy

unread,
Apr 21, 2012, 1:01:37 PM4/21/12
to activejd...@googlegroups.com
Greg, this is correct. It is an annoyance that is a result of instrumentation (I suspect).
Need to cast for now, sorry.
thanks
igor

Greg Mallett

unread,
Apr 21, 2012, 2:32:31 PM4/21/12
to ActiveJDBC Group
Thanks for the answer. I will accept the casts, since this is really
a great, and much needed, library for Java.

Marc

unread,
May 12, 2012, 12:29:52 PM5/12/12
to ActiveJDBC Group
I attached a sample patch to:
http://code.google.com/p/activejdbc/issues/detail?id=156

Hopefully, it will help.

ipolevoy

unread,
May 12, 2012, 12:32:19 PM5/12/12
to activejd...@googlegroups.com
Guys, I will be integrating this patch into main trunk this weekend, and if all is good, will also make a new release.
I always knew I needed to learn some Java :)
Marc, thank you!
igor

evan.leonard

unread,
May 12, 2012, 1:06:33 PM5/12/12
to activejd...@googlegroups.com

w00t!
Reply all
Reply to author
Forward
0 new messages