PicoContainer
  1. PicoContainer
  2. PICO-134

Report unsatisfiable dependencies as lists of parameter types, instead of the non-matching type

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-5
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Given a class:

      public class Dependency {
      public Dependency(int x) {
      }
      public Dependency(String value) {
      }
      public Dependency(String value, int x) {
      }
      }

      then in main():

      pico.registerComponentImplementation("x", Dependency.class);
      pico.getComponentInstance(Dependency.class);

      The original unsatisfied dependency set contains the parameter that failed in ConstructorComponentAdapter.getAllSatisfiableConstructors.

      This yields this output on a org.picocontainer.defaults.UnsatisfiableDependenciesException:

      Unsatisfiable dependencies: [int, class java.lang.String]

      After my diff, it reports the complete constructor parameter list as a List:

      Unsatisfiable dependencies: [[int], [class java.lang.String], [class java.lang.String, int]]

      Which makes it clearer as to what fails.

      The proper output depends on Joerg Schaible's patch in PICO-131. Without that, ArrayIndexOutOfBoundsException happens. Please ignore my diffs posted in PICO-131.

        Activity

        Hide
        Miguel Paraz added a comment -

        Patch against the source and test case.

        Show
        Miguel Paraz added a comment - Patch against the source and test case.
        Miguel Paraz made changes -
        Field Original Value New Value
        Attachment ParameterList.diff [ 11399 ]
        Hide
        Aslak Hellesøy added a comment -

        Nice

        Show
        Aslak Hellesøy added a comment - Nice
        Aslak Hellesøy made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.0-beta-5 [ 10145 ]
        Status Open [ 1 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Miguel Paraz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: