Commit 1e5db48
Fold OptimizedTagMap into a final class TagMap (drop the interface)
TagMap was an interface with a single implementation, OptimizedTagMap. The
split was vestigial scaffolding from when a second (HashMap-backed) impl
existed; with one impl it is false generalization. Collapse them into one
`public final class TagMap`:
- The interface's abstract method declarations are removed; OptimizedTagMap's
bodies become TagMap's methods.
- Nested types that were implicitly `public static` in the interface
(EntryChange, EntryRemoval, EntryReader, Entry, Ledger) are now written out
explicitly as `public static`.
- Static factories (create/fromMap/ledger/...) and the EMPTY constant become
explicit `public static` members; the EmptyHolder lazy-init note is updated
now that there is no interface<->impl class-init cycle.
- putAll(TagMap) loses its `instanceof` dispatch (always true once there is one
class) and calls the fast path directly.
No behavior change; motivation is code simplicity, not performance (a single
final class is monomorphic by construction, but CHA already devirtualized the
sole impl). Public API is preserved, so callers are unchanged; the 3 tests that
referenced OptimizedTagMap now reference TagMap.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent c451336 commit 1e5db48
4 files changed
Lines changed: 141 additions & 378 deletions
File tree
- internal-api/src
- main/java/datadog/trace/api
- test/java/datadog/trace/api
0 commit comments