Fix #1523: expose Slider.setProgressInternal as protected#5118
Merged
Conversation
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Contributor
Cloudflare Preview
|
Collaborator
Author
|
Compared 122 screenshots: 122 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
The 2015 reporter wanted to build a range slider on top of Slider but could not because setProgressInternal(int) was package-private private. Every value-set path in the class (setProgress, pointerDragged, keyboard repeat handlers, etc.) funnels through this method, so a subclass that wants to intercept value changes has no clean hook. Promote the method to protected and document the contract. No behavioural change for existing callers (the access widening is source/binary compatible), and an override picks up updates from every input path uniformly. Closes #1523. Adds maven/core-unittests/.../SliderSetProgressInternalScopeTest.java that defines a ProbeSlider subclass with an @OverRide on setProgressInternal. If the method ever regresses back to private the test will fail to compile, and the body assertions verify the override is actually called when setProgress runs. Full Slider+SliderBridge suite (27 tests) stays green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9b877e5 to
0d6eb4a
Compare
Collaborator
Author
|
Compared 122 screenshots: 122 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Collaborator
Author
|
Compared 122 screenshots: 122 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
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.
Summary
Closes #1523. The 2015 reporter wanted to build a range slider on top of
Sliderbut couldn't becausesetProgressInternal(int)wasprivate. Every value-set path in the class —setProgress,pointerDragged(line 531), pointer-released (line 585), the keyboard repeat handlers (lines 646, 654, 662, 670) — funnels through this method, so a subclass that wants to intercept value changes has no clean hook.Promote the method to
protectedand add a short javadoc explaining the contract. No behavioural change for existing callers; the access widening is source- and binary-compatible.Test plan
SliderSetProgressInternalScopeTestdefines aProbeSlidersubclass with@Override protected void setProgressInternal(int). If the method ever regresses back toprivatethis class will fail to compile, and the assertions verify that the override is actually called whensetProgressruns (1 call → seen, 3 calls → seen, final value reported correctly).*Slider*test sweep — 27 tests acrossSliderSetProgressInternalScopeTest/ComboBoxTabsSliderTest/SliderBridgeTest— all green.🤖 Generated with Claude Code