|
Re: Dependency Injection in Abstract Classes [message #782804 is a reply to message #782316] |
Tue, 24 January 2012 13:41 |
Eclipse User |
|
|
|
I'm 99% certain My app relies on injection for methods and fields on abstract classes. I've never tried marking an abstract method as being injectable though.
You can see the relevant source in InjctorImpl in the methods processMethods(), isOverridden(
git.eclipse.org/c/platform/eclipse.platform.runtime.git/tree/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
From a quick glance, I can't see anything filtering out abstract methods.
I suggest that you create a small test case demonstrating the problem and attach it to a bug prefixed with "[DI]" at
bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=Runtime
|
|
|
|
Re: Dependency Injection in Abstract Classes [message #783501 is a reply to message #783367] |
Wed, 25 January 2012 20:52 |
Eclipse User |
|
|
|
I asked the Di implementor, Oleg, about this and he said:
Quote:
The strange thing about annotations is that they are not inherited:
Class A {
@Inject
void method1(arg) {...};
}
ClassB extends ClassA {
void method1(arg) {...};
}
Attempt to inject ClassB won't trigger method1 as it is considered to be non-injectable. (There are tests for this in the JSR on the dependency injection and the same logic is used for other Java annotations.)
In looking through my code, my abstract injections were all on fields, not methods.
|
|
|
Powered by
FUDForum. Page generated in 0.03416 seconds