PicoContainer
  1. PicoContainer
  2. PICO-201

PicoContainer finds the greediest constructor, even if it is protected or private

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Currently we have a class that has protected constructors (used mostly for testing purposes), however, Pico tries to instantiate that object using those constructors, instead of the less greedy (but still public) other constructors.

      A work around it to register it with params to indicate to use the noarg constructor:

      internalContainer.registerComponentImplementation(
      UpgradeManager.class,
      UpgradeManagerImpl.class,
      Collections.EMPTY_LIST);

      The problem appears to be that ConstructorInjectionComponentAdapter.getGreediestSatisifableConstructor() can return a constructor which then barfs in InstantiatingComponentAdapter.newInstance().

      I think that this could be solved by making allowNonPublicClasses protected in InstantiatingComponentAdapter ?

      On another note - is Satisifable the correct spelling?

        Issue Links

          Activity

          Jörg Schaible made changes -
          Field Original Value New Value
          Assignee Joerg Schaible [ joehni ]
          Hide
          Jörg Schaible added a comment -

          Hi Scott,

          I fixed it in your proposed way setting "allowNonPublicClasses" to protected and using it in CICA.

          Regards,
          Jörg

          Show
          Jörg Schaible added a comment - Hi Scott, I fixed it in your proposed way setting "allowNonPublicClasses" to protected and using it in CICA. Regards, Jörg
          Jörg Schaible made changes -
          Fix Version/s 1.1 [ 10307 ]
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Hide
          Jörg Schaible added a comment -

          Already fixed.

          Show
          Jörg Schaible added a comment - Already fixed.
          Jörg Schaible made changes -
          Link This issue is duplicated by PICO-205 [ PICO-205 ]

            People

            • Assignee:
              Jörg Schaible
              Reporter:
              Scott Farquhar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: