Add entry-point annotations for test-only code. (#160158)

This change adds entry-point annotations to methods and classes accessed
by native code during Flutter tests. Currently, entry point annotations
are not checked by the Dart VM when running in JIT mode, only in AOT
mode. In order to also enforce entry point annotations in JIT mode,
first tests in Flutter must be appropriately annotated to avoid roll
failures.

Related issues:
* https://github.com/flutter/flutter/issues/118608
* https://github.com/dart-lang/sdk/issues/50649

## 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.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] 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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
Tess Strickland
2024-12-12 14:46:38 +01:00
committed by GitHub
parent 2d3ff85559
commit efa109d405
7 changed files with 7 additions and 0 deletions

View File

@@ -2063,6 +2063,7 @@ Widget createAppWithCenteredButton(Widget child) {
}
@pragma('vm:entry-point')
class _RestorableDialogTestWidget extends StatelessWidget {
const _RestorableDialogTestWidget();

View File

@@ -3177,6 +3177,7 @@ class _TestPostRouteCancelState extends State<_TestPostRouteCancel> {
}
}
@pragma('vm:entry-point')
class _RestorableModalTestWidget extends StatelessWidget {
const _RestorableModalTestWidget();

View File

@@ -2620,6 +2620,7 @@ class _RestorableDatePickerDialogTestWidget extends StatefulWidget {
_RestorableDatePickerDialogTestWidgetState createState() => _RestorableDatePickerDialogTestWidgetState();
}
@pragma('vm:entry-point')
class _RestorableDatePickerDialogTestWidgetState extends State<_RestorableDatePickerDialogTestWidget> with RestorationMixin {
@override
String? get restorationId => 'scaffold_state';

View File

@@ -1785,6 +1785,7 @@ class _RestorableDateRangePickerDialogTestWidget extends StatefulWidget {
_RestorableDateRangePickerDialogTestWidgetState createState() => _RestorableDateRangePickerDialogTestWidgetState();
}
@pragma('vm:entry-point')
class _RestorableDateRangePickerDialogTestWidgetState extends State<_RestorableDateRangePickerDialogTestWidget> with RestorationMixin {
@override
String? get restorationId => 'scaffold_state';

View File

@@ -2975,6 +2975,7 @@ void main() {
});
}
@pragma('vm:entry-point')
class _RestorableDialogTestWidget extends StatelessWidget {
const _RestorableDialogTestWidget();

View File

@@ -2212,6 +2212,7 @@ class _TimePickerLauncher extends StatefulWidget {
_TimePickerLauncherState createState() => _TimePickerLauncherState();
}
@pragma('vm:entry-point')
class _TimePickerLauncherState extends State<_TimePickerLauncher> with RestorationMixin {
@override
String? get restorationId => widget.restorationId;

View File

@@ -2600,6 +2600,7 @@ class WidgetWithNoLocalHistoryState extends State<WidgetWithNoLocalHistory> {
}
}
@pragma('vm:entry-point')
class _RestorableDialogTestWidget extends StatelessWidget {
const _RestorableDialogTestWidget();