Interface bridge methods are considered workflow methods

Aperta
#3,233 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Quinn-With-Two-Ns ci sta già lavorando.

Dal 24/11/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Java
Stelle
447
Fork
278
Merge medio
3g 22h
PR unite (30g)
28

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di temporalio/sdk-java

Tutte le issue di temporalio/sdk-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.