Does Binder.skipSources work with generic classes?

25 views
Skip to first unread message

glenviewjeff

unread,
Feb 14, 2012, 11:34:14 AM2/14/12
to google...@googlegroups.com
Binder.skipSources isn't working for me in a particular class with generic parameters, but does work correctly in an unrelated non-generic class.  Is this possibly a known bug or limitation to skipSources?

Here are more details if relevant.  The issue is from Google Gimlet.

For some inexplicable reason, Guice still reports binding errors inside LegBinder.bindTo().  I am puzzled as to why this occurs, since I verified correct behavior with the skipSources() method in my own binding utility classes.

When you have a binding problem, presently LMB lets Guice report the error at the line inside LMB instead of the line in the LMB client code.  The following change to LMB will fix this:
 
In LegBinder.java, bindTo() method, change this  line:
 
Binder binder = binder();
 
to:
 
Binder binder = binder().skipSources(LegBinder.class, LegModuleBuilder.class, Foot.class, KeyOrInstanceUnionWithLabel.class);
 
See Docs on Binder.skipSources() for details.


glenviewjeff

unread,
Feb 14, 2012, 11:41:57 AM2/14/12
to google...@googlegroups.com
Apparently it does work, but in the generic class LegBinder.class I just needed to use this.getClass() instead of referencing it as follows:

Instead of:


Binder binder = binder().skipSources(LegBinder.class, LegModuleBuilder.class, Foot.class, KeyOrInstanceUnionWithLabel.class);

The following worked:

Binder binder = binder().skipSources(this.getClass(), LegModuleBuilder.class, Foot.class, KeyOrInstanceUnionWithLabel.class);


Reply all
Reply to author
Forward
0 new messages