Interface bridge methods are considered workflow methods

Aberta
#3,233 5 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Quinn-With-Two-Ns já está trabalhando nisso.

Desde 24/11/2026.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
62/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
java

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
Java
Estrelas
447
Forks
278
Merge médio
3d 22h
PRs com merge (30d)
28

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de temporalio/sdk-java

Todas as issues de temporalio/sdk-java

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.