Moved from comment:
You want to cast a Criteria object? That makes no sense. criteria.list()
returns a List, so you could just use that.
The castList
method is odd anyways, you don't gain any compile-time type-safety (it will still only fail at runtime if something is wrong), and it could slow things down, especially if the list is long. I'd just use @SuppressWarnings or live with the warning.