Commit 185dfbb
feat(events): make event serialization usable from another package (#214)
## What
Widens five declarations in `com.launchdarkly.sdk.internal.events` from
package-private to public. **Visibility only — no behavior change.**
| Declaration | What becomes public |
| --- | --- |
| `EventOutputFormatter` | class, constructor, `writeOutputEvents` |
| `EventSummarizerInterface` | interface |
| `AggregatedEventSummarizer` | class, constructor |
| `PerContextEventSummarizer` | class, constructor |
| `EventSummarizer` | class only — so that `EventSummary` can be named |
| `EventSummarizer.EventSummary` | class only |
Everything else stays package-private. `EventSummarizer` and
`EventSummary` gain no callable surface: `EventSummarizer`'s
constructors and methods are untouched, and `EventSummary` cannot be
constructed from outside the package. They are public so the type
`List<EventSummarizer.EventSummary>` can be *named* by a caller passing
it from a summarizer to the formatter.
## Why
The Android SDK's event durability work summarizes and serializes each
event on the thread that recorded it, ahead of the bounded queue that
`DefaultEventProcessor` keeps between the caller and the summarizer.
That means it needs the summarizers and the output formatter directly:
`DefaultEventProcessor` only accepts individual events and summarizes
them itself, so there is no public way to hand java-sdk-internal a
summary that has already been aggregated.
Today the Android SDK gets at them by declaring `AndroidEventBuffer` in
this package — a split package across two artifacts, with a javadoc
workaround to keep it out of the published docs. That works, but it is
not something to keep: it is fragile under any build that takes package
ownership seriously, and it puts a class the Android team maintains
inside a package this repo owns.
With these declarations public, that class moves into
`com.launchdarkly.sdk.android` where it belongs, and the split package
and its build workaround go away. The important part is that the Android
SDK keeps using *this* implementation of the wire format rather than
growing a second copy that could drift from it.
## Notes for review
- The diff is modifiers only, apart from one added line of javadoc on
`EventSummary`, which `JavadocType` requires because it is a newly
public type. No existing comment was edited.
- `javadoc` reports three new `no comment` warnings, on the two
constructors and `writeOutputEvents`. That is the same warning roughly
eighty existing members in this module already produce, and it does not
fail the build.
- `Event`, `EventsConfiguration` and `Sampler` were already public and
needed no change.
- `compileJava`, `checkstyleMain`, `javadoc` and the
`com.launchdarkly.sdk.internal.events.*` tests all pass.
🤖 Generated with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 85d1f7d commit 185dfbb
5 files changed
Lines changed: 23 additions & 10 deletions
File tree
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments