sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Adding a new parameter type List to a workflow input causes the data converter to fail

Open antmendoza opened this issue 8 months ago • 4 comments

Expected Behavior

Adding new parameters to running/closed workflows should be safe for the data converter and converted to null during replay

Actual Behavior

Adding a new parameter of type List to a workflow input causes the data converter to fail.

From:

        @WorkflowMethod
        String execute(String name);

to :

        @WorkflowMethod
        String execute(String name, List<String> names);

throws during replay

Caused by: java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
	at io.temporal.common.converter.DataConverter.fromPayloads(DataConverter.java:162)
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation.execute(POJOWorkflowImplementationFactory.java:349)
	at io.temporal.internal.sync.WorkflowExecutionHandler.runWorkflowMethod(WorkflowExecutionHandler.java:71)

Adding a new parameter of type String or Custom object works as expected.

From:

        @WorkflowMethod
        String execute(String name);

to :

        @WorkflowMethod
        String execute(String name, String names);

        @WorkflowMethod
        String execute(String name, MyObject names);

Steps to Reproduce the Problem

I have attached a project that reproduces the issue

Archive.zip

Specifications

  • Version: SDK 1.27.1
  • Platform:

antmendoza avatar Feb 11 '25 14:02 antmendoza