Change '_handler' from public to package access#225
Merged
Conversation
kukushechkin
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lower the
_handlerproperties frompublictopackageaccess, matching_factory.Motivation:
The
_handler(and_factory) properties onCounter,FloatingPointCounter,Meter,Recorder, andTimerare 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 thatMetricsTestKitcan reach into them.These properties were declared
publicbecause they predate thepackageaccess level. As requested in issue #173 (and the earlier review discussion on #172, where the maintainers asked forpackageto be used),_factorywas already migrated topackage. This change finishes the job for the matching_handlerproperties so the testing-only surface is no longer part of the public API.Modifications:
_handleronCounter,FloatingPointCounter,Meter,Recorder, andTimerfrompublic letto@usableFromInline package let.@usableFromInlinebecause_handleris referenced from existing@inlinablemembers (increment,reset,record,destroy, ...); this mirrors the existing@usableFromInline package let _factorydeclaration.package(instead of "only public") to allow access fromMetricsTestKit.Result:
The
_handlerand_factorytesting-only properties are nowpackagerather thanpublic, consistent with their documented "not public API" intent and with the maintainers' request.MetricsTestKitcontinues 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