Trying to understand example in the WorkflowInterface annotation documentation

Hi, I’m looking at the example given in the JavaDocs for the WorkflowInterface annotation. I’ll quote it here:

public interface A {
    @SignalMethod
     a();
     aa();
 }

@WorkflowInterface
 public interface B extends A {
    @SignalMethod
     b();

    @SignalMethod // must define the type of the inherited method
     aa();
 }

@WorkflowInterface
 public interface C extends B {
   @WorkflowMethod
    c();
 }

@WorkflowInterface
 public interface D extends C {
   @QueryMethod
    String d();
 }

 public class CImpl implements C {
     public void a() {}
     public void aa() {}
     public void b() {}
     public void c() {}
     public String d() { return "foo"; }
 }

The text below the code says:

When CImpl instance is registered with the Worker the following is registered:

  • d query method

The d() query method is declared with the @QueryMethod annotation in interface D. The CImpl class implements interface C, which extends interfaces B and A, but not D. Class CImpl defines a method d() but without a @QueryMethod annotation. Why is d() registered as a query method if CImpl implements an interface that neither declares a @QueryMethod annotated method d() nor extends an interface that does?

Thanks for pointing this out. The JavaDoc is wrong as d method doesn’t belong to the C interface. Would you file a github issue to get this fixed?

Would you file a github issue to get this fixed?

Yes of course, thank you. Done.

1 Like