hmanikkothu / atinject

Automatically exported from code.google.com/p/atinject
0 stars 0 forks source link

Ordering of field/method injection in the presence of subclassing? #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The spec for @Inject says: "Constructors are injected first, followed by
fields, and then methods. Fields and methods in superclasses are injected
before those in subclasses."

Maybe it's just me, but I am unsure about the intended ordering in the
presence of inheritance and both injectable methods and fields. Given a
class A and a class B that extends A, it is not clear if the order of
injection is fields(A),methods(A),fields(B),methods(B) or
fields(A),fields(B),methods(A),methods(B).

Original issue reported on code.google.com by bokowski on 10 Sep 2009 at 4:59

GoogleCodeExporter commented 8 years ago

Original comment by bokowski on 10 Sep 2009 at 5:04

GoogleCodeExporter commented 8 years ago
"Fields *and* methods in superclasses are injected before those in subclasses." 
This 
means that both fields and methods in a superclass will be injected before 
fields or 
methods in a subclass.

Original comment by crazybob...@gmail.com on 10 Sep 2009 at 10:37

GoogleCodeExporter commented 8 years ago
Methods from A overridden by B belong to B and are therefore invoked after 
injecting fields in B, right?

Original comment by eclipseguru@gmail.com on 11 Sep 2009 at 7:20

GoogleCodeExporter commented 8 years ago
Correct.

Original comment by crazybob...@gmail.com on 11 Sep 2009 at 7:24