Interface bridge methods are considered workflow methods

オープン
#3,233 コメント 5 件 リアクション 0 件 担当者 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時間
マージ済み PR(30日)
28

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

temporalio/sdk-java のほかの issue

temporalio/sdk-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。