PicoContainer
  1. PicoContainer
  2. PICO-316

Problems with named setter injection

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.4
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      From Martin Fuzzey on the list:

      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 [!Unable to render embedded object: File (} if testBad then testGood are run they both fail... [) not found.!]

      This is inspite of each test creating its own picocontainer instance.
      Looks like some data is being kept around (static fields??)

      Martin

        People

        • Assignee:
          Paul Hammant
          Reporter:
          Michael Rimov
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: