-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[CP-stable]fix: remove final class modifier on MenuController #176725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CP-stable]fix: remove final class modifier on MenuController #176725
Conversation
fix: remove final class modifier on MenuController fixes: flutter#174082 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
|
@dkwingsmt please fill out the PR description above, afterwards the release team will review this request. |
|
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request removes the final modifier from the MenuController class, allowing it to be extended. A corresponding test case has been added to verify that MenuController can be subclassed and its methods overridden. The changes are correct and well-tested. I've added a couple of suggestions to improve documentation in the new test code to align with the Flutter style guide.
| // Custom MenuController that extends the base MenuController | ||
| // This verifies that the final modifier has been removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Flutter Style Guide, it's recommended to use /// for documentation, even for test-only classes. This improves readability and maintainability.
Ref: Flutter Style Guide - Documentation (line 62).
| // Custom MenuController that extends the base MenuController | |
| // This verifies that the final modifier has been removed | |
| /// A custom [MenuController] that extends the base [MenuController] to verify | |
| /// that the `final` modifier has been removed. |
| int openCallCount = 0; | ||
| int closeCallCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Flutter Style Guide, all public members should have documentation. Please add doc comments for these fields to improve code clarity.
Ref: Flutter Style Guide - Documentation (line 53).
| int openCallCount = 0; | |
| int closeCallCount = 0; | |
| /// The number of times [open] has been called. | |
| int openCallCount = 0; | |
| /// The number of times [close] has been called. | |
| int closeCallCount = 0; |
|
@dkwingsmt can you update the pr description to a changelog that meets our guidelines. @justinmc for framework approval + autosubmit. |
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 . And confirmed that this is a high value low risk thing to cherry pick.
284ec68
into
flutter:flutter-3.35-candidate.0
|
@reidbaker Can you tell me where it doesn't meet? I specifically read the guideline before writing the current one. |
"What the scenario is (describe the problem). What platforms it affects. In what context it may occur. How likely it is to occur" Here is my attempt at following the guidelines. flutter/174082 Apps, on all platforms, that extend MenuController class see a compile time failure when building. Starts with the issue, describes where in the developers code would be impacted, describes the problem in the state prior to being fixed and describes what platforms are impacted. |
|
I see. Yeah, I thought I would skip the platforms since they apply to all platforms. Thank you. |
|
No worries you are far from the first person to be confused. |
The issue is users dont actually think that no platform information means all platforms. |
This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
Issue Link:
What is the link to the issue this cherry-pick is addressing?
#174082
Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See best practices for examples
#174082 Apps, on all platforms, that extend MenuController class see a compile time failure when building.
Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Apps that used to rely on extended
MenuControllers won't build.Workaround:
Is there a workaround for this issue?
The app will have to modify their local Flutter repository. Otherwise, if the app really rely on extending the
MenuControllerclass to do custom logic, I can think of no ways for them to continue this customization under this restriction.Risk:
What is the risk level of this cherry-pick?
Test Coverage:
Are you confident that your fix is well-tested by automated tests?
Validation Steps:
What are the steps to validate that this fix works?
The following snippet builds.