fmgasparino / google-gin

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

disallow @inject on provider methods #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using @Inject on a provider method.

What is the expected output? What do you see instead?
Injection is automatic in provider methods but this is not documented well.
Adding @Inject causes loops that are not visible to the developer because
they are hidden in generated code.

What version of the product are you using? On what operating system?
I'm using gin with adplanner. As far as I know our version is current.

It should be an error (in Guice, not only Gin) to annotate provider methods
with @Inject. Module objects should be created with "new" instead of trying
to inject them in Gin.

Original issue reported on code.google.com by jhart...@gmail.com on 18 Mar 2009 at 8:32

GoogleCodeExporter commented 9 years ago
I think it's safe to use "new" on modules and will create a patch.  Brian, do 
you
agree (since you wrote the provider methods)?

Original comment by aragos on 18 Mar 2009 at 8:40

GoogleCodeExporter commented 9 years ago
Patch submitted for review: http://codereview.appspot.com/32073

Original comment by aragos on 30 Mar 2009 at 10:03

GoogleCodeExporter commented 9 years ago
Gin won't cause an infinite loop on this anymore. The original issue (Guice 
allows
@Inject on provider methods) is not fixed, but shouldn't be as large a problem.

Original comment by aragos on 16 May 2009 at 12:01