Martin Fuzzey
2008-06-23 16:39:06 UTC
Hi,
I'm having weird problems with named setter injection.
The attached test case demonstrates this.
The problem occurs when a class requires the injection of two objects
of the same type (disambiguated by USE_NAMES) _and_ another object.
Depending on the declaration order of the setters it works or fails.
I think this is related to the method
IterativeInjector.getMatchingParameterListForSetters() which contains
two nested loops that seem to mismatch types..
The test case also shows another strange behaviour :
it contains two tests, testGood and testBad which invoke the same code
on two classes GoodTarget and BadTarget whose only difference is the
order of the setters.
If just testGood is run it passes [normal]
if just testBad is run it fails [the problem]
if testGood then testBad are run they both pass [!!}
if testBad then testGood are run they both fail... [!!]
This is inspite of each test creating its own picocontainer instance.
Looks like some data is being kept around (static fields??)
Martin
I'm having weird problems with named setter injection.
The attached test case demonstrates this.
The problem occurs when a class requires the injection of two objects
of the same type (disambiguated by USE_NAMES) _and_ another object.
Depending on the declaration order of the setters it works or fails.
I think this is related to the method
IterativeInjector.getMatchingParameterListForSetters() which contains
two nested loops that seem to mismatch types..
The test case also shows another strange behaviour :
it contains two tests, testGood and testBad which invoke the same code
on two classes GoodTarget and BadTarget whose only difference is the
order of the setters.
If just testGood is run it passes [normal]
if just testBad is run it fails [the problem]
if testGood then testBad are run they both pass [!!}
if testBad then testGood are run they both fail... [!!]
This is inspite of each test creating its own picocontainer instance.
Looks like some data is being kept around (static fields??)
Martin