Interface bridge methods are considered workflow methods

未关闭
#3,233 5 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@Quinn-With-Two-Ns 已经在做这个了。

开始于 2026年11月24日。

评估

难度
3/5
预计耗时
半天
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java

调研方向

The duplicate check lives in POJOWorkflowInterfaceMetadata.java, where getDeclaredMethods() is read and only synthetic methods are filtered out. Start by reproducing the BaseWF/ConcreteWF example through POJOWorkflowInterfaceMetadata.newInstance(ConcreteWF.class), then confirm the bridge method for run(Record) is the one being counted. Done means the bridge method is skipped, the metadata builds without the Duplicated @WorkflowMethod error, and a test covers the generic-interface case.

由索引模型根据 Issue 内容生成。

描述

Expected Behavior

Following the example at
https://github.com/temporalio/sdk-java/blob/main/temporal-sdk/src/test/java/io/temporal/workflow/PolymorphicStartTest.java
I expected for it to work in the following scenario:

public interface BaseWF<RQ extends Record, RSP extends Record> {
    RSP run(RQ request);
}

@WorkflowInterface
public interface ConcreteWF extends BaseWF<Request, Response> {
    @WorkflowMethod
    @Override
    Response run(Request request);
}

public record Request(int dummy) {}

public record Response(int dummy) {}

Actual Behavior

It fails on interface metadata retrieval with message (edited for brevity):

Duplicated @WorkflowMethod: public default java.lang.Record BaseWF.run(java.lang.Record) and public abstract Response ConcreteWF.run(Request)

because it calls workflowInterface.getDeclaredMethods() to get workflow methods. But in the scenario above Java generates a "declared" bridge method and current code in POJOWorkflowInterfaceMetadata only checks for synthetic methods and wrongfully considers a bridge method (which is by its nature the same method) a second workflow method.

All the while should it have ignored the bridge method, it would have worked in a true polymorphic fashion, because ConcreteWF would have resolved all type parameters to natively serializable concrete Records.

Steps to Reproduce the Problem

  1. Implement scenario above
  2. Call POJOWorkflowInterfaceMetadata.newInstance(ConcreteWF.class)

Specifications

  • Version: 1.40.0
  • Platform: Linux, Java 26
主要语言
Java
星标
447
派生
278
平均合并
3 天 22 小时
30 天内合并 PR
28

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

temporalio/sdk-java 的其他 Issue

查看 temporalio/sdk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。