I am not aware right now of any way to infer the type a workflow returns if you don’t have access to the workflow interface.
what do you mean by this?
getResult is a blocking operation. If the workflow status == WORKFLOW_EXECUTION_STATUS_RUNNING, it will wait/block your code until the workflow is completed. For any other status != WORKFLOW_EXECUTION_STATUS_COMPLETED (and WORKFLOW_EXECUTION_STATUS_RUNNING) the invocation to getResult will throw an exception (You might want to add WORKFLOW_EXECUTION_STATUS_FAILED to your switch)
The reason is that the SDK query the visibility store and there is a delay between the workflow data and the data that the visibility store shows (i.e. executionInfo.getStatus() could be = WORKFLOW_EXECUTION_STATUS_RUNNING in the visibility store, but the actual workflow is actually completed).