Skip to content

[camerax] Marks all wrapped classes as immutable - #4451

Merged
auto-submit[bot] merged 18 commits into
flutter:mainfrom
camsim99:camx_immutable
Jul 14, 2023
Merged

[camerax] Marks all wrapped classes as immutable#4451
auto-submit[bot] merged 18 commits into
flutter:mainfrom
camsim99:camx_immutable

Conversation

@camsim99

@camsim99camsim99 commented Jul 12, 2023

Copy link
Copy Markdown
Contributor

Marks all Dart-wrapped Android native classes as @immutable. They are all immutable anyway because they extend JavaObject which is immutable, but marking them as immutable explicitly avoids lint warnings caused by must_be_immutable when generated mocks of these classes are used (see dart-lang/build#4729).

Also, updates CONTRIBUTING.md to include marking wrapped classes as immutable and extending JavaObject as requirements for adding new wrapped classes.

cc @ChristianEdwardPadilla: this should fix the internal lint errors caused by JavaObject being immutable.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • 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.
  • All existing and new tests are passing.

@camsim99
camsim99 marked this pull request as ready for review July 13, 2023 19:59
@gmackall
gmackall requested a review from a teamJuly 13, 2023 21:02
@gmackall

gmackall commented Jul 14, 2023

Copy link
Copy Markdown
Member

Interesting, it looks like once one of us reviews it makes the review on behalf of the android-reviewers team and removes the request

@camsim99camsim99 added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Jul 14, 2023
@auto-submit
auto-submitBot merged commit 6181f65 into flutter:mainJul 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 17, 2023
auto-submitBot pushed a commit to flutter/flutter that referenced this pull request Jul 17, 2023
flutter/packages@369ee7e...6889cca
2023-07-17 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.20.3 to 2.20.4 (flutter/packages#4490)
2023-07-15 stuartmorgan@google.com [ci] Switch Android unit tests to LUCI (flutter/packages#4406)
2023-07-15 stuartmorgan@google.com [ci] Introduce LUCI versions of Linux desktop platform tests (flutter/packages#4223)
2023-07-14 43054281+camsim99@users.noreply.github.com [camerax] Marks all wrapped classes as immutable (flutter/packages#4451)
2023-07-14 47866232+chunhtai@users.noreply.github.com [go_router] Bumps example go_router version and migrate example code (flutter/packages#4469)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
flutter/packages@369ee7e...6889cca
2023-07-17 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.20.3 to 2.20.4 (flutter/packages#4490)
2023-07-15 stuartmorgan@google.com [ci] Switch Android unit tests to LUCI (flutter/packages#4406)
2023-07-15 stuartmorgan@google.com [ci] Introduce LUCI versions of Linux desktop platform tests (flutter/packages#4223)
2023-07-14 43054281+camsim99@users.noreply.github.com [camerax] Marks all wrapped classes as immutable (flutter/packages#4451)
2023-07-14 47866232+chunhtai@users.noreply.github.com [go_router] Bumps example go_router version and migrate example code (flutter/packages#4469)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbakerreidbaker mentioned this pull request Aug 4, 2023
11 tasks
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Marks all Dart-wrapped Android native classes as `@immutable`. They are all immutable anyway because they extend `JavaObject` which is immutable, but marking them as immutable explicitly avoids lint warnings caused by [`must_be_immutable`](https://dart.dev/tools/diagnostic-messages#must_be_immutable) when generated mocks of these classes are used (see https://github.com/dart-lang/mockito/issues/200).
Also, updates `CONTRIBUTING.md` to include marking wrapped classes as immutable and extending `JavaObject` as requirements for adding new wrapped classes.
cc @ChristianEdwardPadilla: this should fix the internal lint errors caused by `JavaObject` being immutable.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
Marks all Dart-wrapped Android native classes as `@immutable`. They are all immutable anyway because they extend `JavaObject` which is immutable, but marking them as immutable explicitly avoids lint warnings caused by [`must_be_immutable`](https://dart.dev/tools/diagnostic-messages#must_be_immutable) when generated mocks of these classes are used (see https://github.com/dart-lang/mockito/issues/200).
Also, updates `CONTRIBUTING.md` to include marking wrapped classes as immutable and extending `JavaObject` as requirements for adding new wrapped classes.
cc @ChristianEdwardPadilla: this should fix the internal lint errors caused by `JavaObject` being immutable.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: camera

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@camsim99@gmackall@reidbaker