Skip to content

Change '_handler' from public to package access#225

Merged
kukushechkin merged 1 commit into
apple:mainfrom
adityasingh2400:fix-issue-173
May 29, 2026
Merged

Change '_handler' from public to package access#225
kukushechkin merged 1 commit into
apple:mainfrom
adityasingh2400:fix-issue-173

Conversation

@adityasingh2400

Copy link
Copy Markdown
Contributor

Lower the _handler properties from public to package access, matching _factory.

Motivation:

The _handler (and _factory) properties on Counter, FloatingPointCounter, Meter, Recorder, and Timer are not part of the public API. Their doc comments already state "Do not consider them part of the public API" and they are hidden from documentation via @_documentation(visibility: internal). They are only exposed so that MetricsTestKit can reach into them.

These properties were declared public because they predate the package access level. As requested in issue #173 (and the earlier review discussion on #172, where the maintainers asked for package to be used), _factory was already migrated to package. This change finishes the job for the matching _handler properties so the testing-only surface is no longer part of the public API.

Modifications:

  • Changed _handler on Counter, FloatingPointCounter, Meter, Recorder, and Timer from public let to @usableFromInline package let.
  • Added @usableFromInline because _handler is referenced from existing @inlinable members (increment, reset, record, destroy, ...); this mirrors the existing @usableFromInline package let _factory declaration.
  • Updated the accompanying doc comments to say the properties are only package (instead of "only public") to allow access from MetricsTestKit.

Result:

The _handler and _factory testing-only properties are now package rather than public, consistent with their documented "not public API" intent and with the maintainers' request. MetricsTestKit continues to access them within the same package, and the full test suite passes (103 tests in 8 suites). Note this lowers the access level of underscore-prefixed, documentation-hidden symbols, so it is technically source-breaking for any code that reached into them directly.

Fixes #173

@kukushechkin kukushechkin added the 🔨 semver/patch No public API change. label May 29, 2026
@kukushechkin kukushechkin merged commit 5ca529c into apple:main May 29, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change 'public' to 'package' access modifiers of properties used for testing

2 participants