xiaodududu / google-guice

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

requireExplicitBindings() is incompatible with TypeConverters & ConvertedConstantBindings #610

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to use requireExplicitBindings() to verify that I am not 
accidentally experiencing JIT binding of zero-arg constructor objects that I do 
not expect.

Unfortunately, I also make use of bindConstant(), and the explicit binding 
checker does not consider a bindConstant() binding to be explicit enough.

I found this unexpected, and would suggest that bindConstant() bindings should 
satisfy the explicitness checker, so that I can have both the benefits of 
explicitness checking and of configuration constant injection.

Original issue reported on code.google.com by m...@j.maxb.eu on 1 Mar 2011 at 5:56

GoogleCodeExporter commented 9 years ago
Can you attach a test with your expectation that is currently failing?  Thanks

Original comment by sberlin on 1 Mar 2011 at 6:16

GoogleCodeExporter commented 9 years ago
Attached. The new test is just a copy/paste of 
TypeConversionTest.testConstantInjection, renamed to 
testConstantInjectionStillWorksWithRequireExplicitBindings, and with the lines:

        binder().requireExplicitBindings();
        bind(Foo.class);

added.

Original comment by m...@j.maxb.eu on 1 Mar 2011 at 11:29

Attachments:

GoogleCodeExporter commented 9 years ago
fixed in r1512.

Original comment by sberlin on 2 Mar 2011 at 1:54