Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-843

Bean can not be created if constructor argument use generics

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.3
    • blueprint-core-1.0.1
    • Blueprint
    • None

    Description

      If a bean has a constructor argument which use generics, the injection fails with "org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to find a matching constructor".

      Example:
      package example;
      public interface Example<A> {}

      public class ExampleImpl implements Example<String> {}

      public class Service {
      private Example<String> example;
      public Service(Example<String> example)

      { this.example = example; }

      }

      <bean id="exampleBean" class="example.ExampleImpl"/>

      <bean id="serviceBean" class="example.Service">
      <argument ref="exampleBean"/>
      </bean>

      Changing the constructor of Service to "public Service(Example example)" make it work, but it would be better to have it inject correctly with the generics intact.

      Attachments

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              pergis Tomas Forsman
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: