JBehave
  1. JBehave
  2. JBEHAVE-1049

StepCreator doesn't support method generics parameters

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.9.4
    • Fix Version/s: 3.9.5
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      1

      Description

      The issue is described here :
      http://www.mail-archive.com/dev@jbehave.codehaus.org/msg09141.html

      There is an example project attached

      Description
      The scenario fails because
      "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No parameter converter for interface java.util.List'

      If i debug, he passes through the StringListConverter, but in the accept method the type is not an instance of ParameterizedType, because in the StepCreator class you use method.getParameterTypes() that doesn't retrieve de generics but the Class type (so java.util.List)

      Solution
      StepCreator at line 805 :
      https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java

      Should be :
      Type[] parameterTypes = method.getGenericParameterTypes();

      And the Parameter class should receive a Type instead of a Class type

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Affects Version/s 3.9.5 [ 20598 ]
        Affects Version/s 3.9.4 [ 20449 ]
        Mauro Talevi made changes -
        Summary StepCreator doesn't take Type parameters but Class<?> of parameters StepCreator doesn't support method generics parameters
        Matthieu Mestrez made changes -
        Description The issue is described here :
        http://www.mail-archive.com/dev@jbehave.codehaus.org/msg09141.html

        There is an example project attached


        Description :
        >> > The scenario fails because
        >> "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No
        >> parameter converter for interface java.util.List'
        >> >
        >> >
        >> > If i debug, he passes through the StringListConverter, but in the
        >> accept method the type is not an instance of ParameterizedType, because in
        >> the StepCreator class you use method.getParameterTypes() that doesn't
        >> retrieve de generics but the Class type (so java.util.List)
        >> >
        >> > I think that you should use for that Parameter class the Type and not
        >> the Class
        The issue is described here :
        http://www.mail-archive.com/dev@jbehave.codehaus.org/msg09141.html

        There is an example project attached


        *Description*
        The scenario fails because
        "org.jbehave.core.steps.ParameterConverters$ParameterConvertionFailed: No parameter converter for interface java.util.List'

        If i debug, he passes through the StringListConverter, but in the accept method the type is not an instance of ParameterizedType, because in the StepCreator class you use method.getParameterTypes() that doesn't retrieve de generics but the Class type (so java.util.List)

        *Solution*
        StepCreator at line 805 :
        https://github.com/jbehave/jbehave-core/blob/master/jbehave-core/src/main/java/org/jbehave/core/steps/StepCreator.java

        Should be :
        Type[] parameterTypes = method.getGenericParameterTypes();

        And the Parameter class should receive a Type instead of a Class type
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Assignee Mauro Talevi [ maurotalevi ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Matthieu Mestrez
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: