• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #431

18 Nov 2026 09:28PM UTC coverage: 71.813% (+0.01%) from 71.8%
#431

push

github

web-flow
Include inherited fields in service stub options toString (#3152)

* Include inherited fields in service stub options toString

WorkflowServiceStubsOptions.toString rendered only the five fields
declared on the subclass, silently dropping every field inherited from
ServiceStubsOptions. Target, TLS settings, timeouts, and headers were
absent from the output, which is exactly the connection information
wanted when diagnosing a client from logs.

OperatorServiceStubsOptions and CloudServiceStubsOptions had no
toString at all and fell back to Object.toString, logging as an
unreadable identity hash.

Extract the field rendering on ServiceStubsOptions into a
package-private toStringFields helper and have each subclass inline it
alongside its own fields. The helper is package-private because all
four classes live in io.temporal.serviceclient, so this adds no public
API surface.

Also include apiKeyProvided, which already participates in equals and
hashCode but was omitted from toString. The API key itself is held by a
metadata provider and is still never rendered.

Fixes #2148.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Render header names instead of header values in toString

Metadata.toString renders header values in the clear. The previous
commit propagated the inherited headers field into
WorkflowServiceStubsOptions, OperatorServiceStubsOptions, and
CloudServiceStubsOptions, which would have newly exposed any credential
supplied through setHeaders, such as a static Authorization header.

Render the header names only. This keeps the diagnostic signal that
matters when reading the output, whether a header is configured and
which ones, without printing what they contain.

Also add a regression test for the missing separator before
congestionInitialInterval in RpcRetryOptions.toString.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add changelog entry for service stub options toString

Co-Authored-By: Claude Opus 5.5 <noreply@anthro... (continued)

8779 of 14371 branches covered (61.09%)

Branch coverage included in aggregate %.

5 of 6 new or added lines in 4 files covered. (83.33%)

892 existing lines in 36 files now uncovered.

34625 of 46069 relevant lines covered (75.16%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.77
/temporal-sdk/src/main/java/io/temporal/workflow/TimerOptions.java
1
package io.temporal.workflow;
2

3
import io.temporal.common.Experimental;
4
import java.util.*;
5

6
/** TimerOptions is used to specify options for a timer. */
7
public final class TimerOptions {
8

9
  public static TimerOptions.Builder newBuilder() {
10
    return new TimerOptions.Builder();
1 ✔
11
  }
12

13
  public static TimerOptions.Builder newBuilder(TimerOptions options) {
UNCOV
14
    return new TimerOptions.Builder(options);
×
15
  }
16

17
  public static TimerOptions getDefaultInstance() {
UNCOV
18
    return DEFAULT_INSTANCE;
×
19
  }
20

21
  private static final TimerOptions DEFAULT_INSTANCE;
22

23
  static {
24
    DEFAULT_INSTANCE = TimerOptions.newBuilder().build();
1 ✔
25
  }
1 ✔
26

27
  public static final class Builder {
28
    private String summary;
29
    private List<EventGroup> eventGroups;
30

31
    private Builder() {}
32

33
    private Builder(TimerOptions options) {
×
UNCOV
34
      if (options == null) {
×
35
        return;
×
36
      }
UNCOV
37
      this.summary = options.summary;
×
UNCOV
38
      if (!options.eventGroups.isEmpty()) {
×
UNCOV
39
        this.eventGroups = new ArrayList<>(options.eventGroups);
×
40
      }
UNCOV
41
    }
×
42

43
    /**
44
     * Single-line fixed summary for this timer that will appear in UI/CLI. This can be in
45
     * single-line Temporal Markdown format.
46
     *
47
     * <p>Default is none/empty.
48
     */
49
    public Builder setSummary(String summary) {
50
      this.summary = summary;
1 ✔
51
      return this;
1 ✔
52
    }
53

54
    /**
55
     * Event Groups to associate with this timer. Calls accumulate.
56
     *
57
     * @see EventGroup
58
     */
59
    @Experimental
60
    public Builder addEventGroups(EventGroup... eventGroups) {
61
      if (eventGroups.length == 0) return this;
1 ✔
62
      if (this.eventGroups == null) {
1 !
63
        this.eventGroups = new ArrayList<>(eventGroups.length);
1 ✔
64
      }
65
      for (EventGroup group : eventGroups) {
1 ✔
66
        this.eventGroups.add(Objects.requireNonNull(group, "eventGroups"));
1 ✔
67
      }
68
      return this;
1 ✔
69
    }
70

71
    /**
72
     * Associates the given Event Groups, in addition to any already added. Calls accumulate.
73
     *
74
     * @see EventGroup
75
     */
76
    @Experimental
77
    public Builder addEventGroups(List<EventGroup> eventGroups) {
78
      return addEventGroups(eventGroups.toArray(new EventGroup[0]));
×
79
    }
80

81
    public TimerOptions build() {
82
      return new TimerOptions(summary, eventGroups);
1 ✔
83
    }
84
  }
85

86
  private final String summary;
87
  private final List<EventGroup> eventGroups;
88

89
  private TimerOptions(String summary, List<EventGroup> eventGroups) {
1 ✔
90
    this.summary = summary;
1 ✔
91
    this.eventGroups =
1 ✔
92
        eventGroups == null || eventGroups.isEmpty()
1 !
93
            ? Collections.emptyList()
1 ✔
94
            : Collections.unmodifiableList(new ArrayList<>(eventGroups));
1 ✔
95
  }
1 ✔
96

97
  public String getSummary() {
98
    return summary;
1 ✔
99
  }
100

101
  @Experimental
102
  public List<EventGroup> getEventGroups() {
103
    return eventGroups;
1 ✔
104
  }
105

106
  public Builder toBuilder() {
UNCOV
107
    return new Builder(this);
×
108
  }
109

110
  @Override
111
  public String toString() {
UNCOV
112
    return "TimerOptions{" + "summary='" + summary + '\'' + ", eventGroups=" + eventGroups + '}';
×
113
  }
114

115
  @Override
116
  public boolean equals(Object o) {
UNCOV
117
    if (this == o) return true;
×
UNCOV
118
    if (o == null || getClass() != o.getClass()) return false;
×
UNCOV
119
    TimerOptions that = (TimerOptions) o;
×
UNCOV
120
    return Objects.equals(summary, that.summary) && Objects.equals(eventGroups, that.eventGroups);
×
121
  }
122

123
  @Override
124
  public int hashCode() {
UNCOV
125
    return Objects.hash(summary, eventGroups);
×
126
  }
127
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc