vipx / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

@Finder annotation issue #764

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In @Finder annotation returnAs() has default value Collection.class. However, 
if you forget to specify it, it throws an exception because it cannot create an 
instance of class Collection.class. e.g.

// the following will throw an exception.
@Finder(namedQuery = "MyNamedQuery")
List<MyEntity> someQuery(@Named("name") String name);

// this is fine
@Finder(namedQuery = "MyNamedQuery", returnAs = LinkedList.class)
List<MyEntity> someQuery(@Named("name") String name);

returnAs() should either have no default value, to enforce the user to specify 
it, or have LinkedList.class/ArrayList.class as a default value.

Original issue reported on code.google.com by vesko.m....@gmail.com on 19 Aug 2013 at 1:52