From 92e574649408bbb1759bceee7624ac9ef6411d5b Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 21 Mar 2023 15:25:10 +0000 Subject: [PATCH] Reland "[vm/ffi] Add class modifiers" This is a reland of commit 1755f8909264330a207a0e0e44d31f5fec9c489a Can land after (or with) the Flutter PR: https://github.com/flutter/engine/pull/40434 Original change's description: > [vm/ffi] Add class modifiers > > Adds class modifiers to `dart:ffi`. > > Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`, > and `AbiSpecificInteger` to be `final class`es. > > Does not remove the manual error checking, so some errors will show up > twice now in language version 3.0. In language version <3.0, only the > FFI-specific error will show up. > > In a follow-up CL, we will try to make the language-errors to show up > also <3.0 so that we can remove the FFI-specific errors. > > Examples of duplicated errors: > pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart > > TEST=pkg/analyzer/test/ (for the analyzer) > TEST=pkg/front_end/testcases/ (for the CFE) > TEST=test/ffi/ (for the VM) > > CoreLibraryReviewExempt: No need for dart2js to review. > Bug: https://github.com/dart-lang/sdk/issues/51683 > Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3 > Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223 > Reviewed-by: Johnni Winther > Reviewed-by: Devon Carew > Reviewed-by: Brian Wilkerson > Reviewed-by: Jackson Gardner > Reviewed-by: Lasse Nielsen > Commit-Queue: Daco Harkes TEST=pkg/analyzer/test/ (for the analyzer) TEST=pkg/front_end/testcases/ (for the CFE) TEST=test/ffi/ (for the VM) CoreLibraryReviewExempt: No need for dart2js to review. Bug: https://github.com/dart-lang/sdk/issues/51683 Change-Id: I2ee3f0ac31d4162068a2346a06320029b2263ee2 Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289781 Reviewed-by: Devon Carew Reviewed-by: Johnni Winther Commit-Queue: Daco Harkes Reviewed-by: Brian Wilkerson --- benchmarks/FfiBoringssl/dart/types.dart | 8 +- benchmarks/FfiStruct/dart/FfiStruct.dart | 2 +- .../dart/benchmark_generated.dart | 24 ++-- .../FfiStructCopy/generate_benchmarks.dart | 6 +- .../location/relational_pattern_test.dart | 10 +- ...ove_name_from_declaration_clause_test.dart | 64 +++++---- .../lib/src/test_utilities/mock_packages.dart | 2 +- .../lib/src/test_utilities/mock_sdk.dart | 66 ++++----- pkg/analyzer/messages.yaml | 124 ++++++++-------- .../abi_specific_integer_mapping_test.dart | 14 +- .../annotation_on_pointer_field_test.dart | 8 +- .../creation_of_struct_or_union_test.dart | 8 +- ...extra_annotation_on_struct_field_test.dart | 6 +- .../extra_size_annotation_carray_test.dart | 8 +- ...field_must_be_external_in_struct_test.dart | 14 +- .../generic_struct_subclass_test.dart | 10 +- .../invalid_field_type_in_struct_test.dart | 16 +-- ...tched_annotation_on_struct_field_test.dart | 8 +- ...ssing_annotation_on_struct_field_test.dart | 6 +- .../missing_field_type_in_struct_test.dart | 6 +- .../missing_size_annotation_carray_test.dart | 6 +- .../non_constant_type_argument_test.dart | 4 +- .../non_positive_array_dimension_test.dart | 24 ++-- .../non_sized_type_argument_test.dart | 10 +- ...ized_non_nullable_instance_field_test.dart | 2 +- .../packed_annotation_alignment_test.dart | 4 +- .../diagnostics/packed_annotation_test.dart | 14 +- .../size_annotation_dimensions_test.dart | 14 +- .../subtype_of_ffi_class_test.dart | 82 +++++++++-- .../subtype_of_struct_class_test.dart | 63 ++++---- .../test/verify_diagnostics_test.dart | 3 + pkg/analyzer/tool/diagnostics/diagnostics.md | 124 ++++++++-------- .../on_type_variable_inference2.dart | 4 +- ...ype_variable_inference2.dart.strong.expect | 4 +- ..._inference2.dart.strong.transformed.expect | 4 +- ...ble_inference2.dart.textual_outline.expect | 4 +- ...ence2.dart.textual_outline_modelled.expect | 8 +- ..._type_variable_inference2.dart.weak.expect | 4 +- ...riable_inference2.dart.weak.modular.expect | 4 +- ...riable_inference2.dart.weak.outline.expect | 4 +- ...le_inference2.dart.weak.transformed.expect | 4 +- .../testcases/incremental/crash_05.yaml | 4 +- .../incremental/crash_05.yaml.world.1.expect | 4 +- .../incremental/crash_05.yaml.world.2.expect | 4 +- .../testcases/incremental/crash_06.yaml | 4 +- .../incremental/crash_06.yaml.world.1.expect | 4 +- .../incremental/crash_06.yaml.world.2.expect | 4 +- .../testcases/incremental/ffi_01.yaml | 2 +- .../incremental/ffi_01.yaml.world.1.expect | 2 +- .../incremental/ffi_01.yaml.world.2.expect | 2 +- .../testcases/incremental/ffi_02.yaml | 2 +- .../incremental/ffi_02.yaml.world.1.expect | 2 +- .../testcases/incremental/issue_46666.yaml | 6 +- .../issue_46666.yaml.world.1.expect | 6 +- .../issue_46666.yaml.world.2.expect | 6 +- .../incremental/no_outline_change_35.yaml | 4 +- .../no_outline_change_35.yaml.world.1.expect | 2 +- .../no_outline_change_35.yaml.world.2.expect | 2 +- .../no_outline_change_35.yaml.world.3.expect | 2 +- .../incremental/no_outline_change_48_ffi.yaml | 6 +- ..._outline_change_48_ffi.yaml.world.1.expect | 4 +- ..._outline_change_48_ffi.yaml.world.2.expect | 4 +- .../incremental/no_outline_change_49_ffi.yaml | 8 +- ..._outline_change_49_ffi.yaml.world.1.expect | 4 +- ..._outline_change_49_ffi.yaml.world.2.expect | 4 +- .../incremental/no_outline_change_50_ffi.yaml | 6 +- ..._outline_change_50_ffi.yaml.world.1.expect | 4 +- ..._outline_change_50_ffi.yaml.world.2.expect | 4 +- .../testcases/incremental/regress_46004.yaml | 4 +- .../regress_46004.yaml.world.1.expect | 4 +- .../regress_46004.yaml.world.2.expect | 4 +- pkg/front_end/testcases/nnbd/ffi_sample.dart | 2 +- .../nnbd/ffi_sample.dart.strong.expect | 2 +- .../ffi_sample.dart.strong.transformed.expect | 2 +- .../ffi_sample.dart.textual_outline.expect | 2 +- ...ample.dart.textual_outline_modelled.expect | 2 +- .../nnbd/ffi_sample.dart.weak.expect | 2 +- .../nnbd/ffi_sample.dart.weak.modular.expect | 2 +- .../nnbd/ffi_sample.dart.weak.outline.expect | 2 +- .../ffi_sample.dart.weak.transformed.expect | 2 +- .../nnbd/ffi_struct_inline_array.dart | 2 +- ...ffi_struct_inline_array.dart.strong.expect | 2 +- ...nline_array.dart.strong.transformed.expect | 2 +- ...t_inline_array.dart.textual_outline.expect | 2 +- ...array.dart.textual_outline_modelled.expect | 2 +- .../ffi_struct_inline_array.dart.weak.expect | 2 +- ...ruct_inline_array.dart.weak.modular.expect | 2 +- ...ruct_inline_array.dart.weak.outline.expect | 2 +- ..._inline_array.dart.weak.transformed.expect | 2 +- ...struct_inline_array_multi_dimensional.dart | 2 +- ...array_multi_dimensional.dart.strong.expect | 2 +- ...dimensional.dart.strong.transformed.expect | 2 +- ...ti_dimensional.dart.textual_outline.expect | 2 +- ...ional.dart.textual_outline_modelled.expect | 2 +- ...e_array_multi_dimensional.dart.weak.expect | 2 +- ...multi_dimensional.dart.weak.modular.expect | 2 +- ...multi_dimensional.dart.weak.outline.expect | 2 +- ...i_dimensional.dart.weak.transformed.expect | 2 +- .../lib/transformations/ffi/definitions.dart | 4 +- pkg/vm/test/transformations/ffi_test.dart | 6 +- .../transformations/ffi/abi_specific_int.dart | 6 +- .../ffi/abi_specific_int.dart.aot.expect | 6 +- .../ffi/abi_specific_int.dart.expect | 6 +- .../ffi/abi_specific_int_incomplete.dart | 6 +- ...bi_specific_int_incomplete.dart.aot.expect | 6 +- .../abi_specific_int_incomplete.dart.expect | 6 +- .../transformations/ffi/compound_copies.dart | 4 +- .../ffi/compound_copies.dart.expect | 4 +- .../transformer/ffi_struct_constructors.dart | 24 ++-- .../ffi_struct_constructors.dart.expect | 16 +-- ...t_api_create_lightweight_isolate_test.dart | 2 +- .../vm/dart/isolates/thread_pool_test.dart | 2 +- .../vm/dart/thread_priority_macos_test.dart | 2 +- .../vm/compiler/ffi/native_type_vm_test.cc | 2 +- runtime/vm/dart_api_impl_test.cc | 8 +- samples/ffi/async/sample_async_callback.dart | 2 +- samples/ffi/coordinate.dart | 2 +- .../arena_isolate_shutdown_sample.dart | 2 +- .../ffi/resource_management/arena_sample.dart | 2 +- .../arena_zoned_sample.dart | 2 +- samples/ffi/sample_ffi_bitfield.dart | 2 +- .../ffi/sqlite/lib/src/bindings/types.dart | 6 +- .../vm/lib/ffi_dynamic_library_patch.dart | 2 +- .../vm/lib/ffi_native_finalizer_patch.dart | 6 +- .../vm/lib/ffi_native_type_patch.dart | 36 ++--- sdk/lib/_internal/vm/lib/ffi_patch.dart | 12 +- .../_internal/vm/lib/ffi_struct_patch.dart | 10 +- sdk/lib/ffi/abi_specific.dart | 6 +- sdk/lib/ffi/annotations.dart | 4 +- sdk/lib/ffi/c_type.dart | 30 ++-- sdk/lib/ffi/dynamic_library.dart | 2 +- sdk/lib/ffi/ffi.dart | 20 +-- sdk/lib/ffi/native_finalizer.dart | 6 +- sdk/lib/ffi/native_type.dart | 38 ++--- sdk/lib/ffi/struct.dart | 8 +- sdk/lib/ffi/union.dart | 4 +- .../abi_specific_int_incomplete_aot_test.dart | 2 +- .../abi_specific_int_incomplete_jit_test.dart | 8 +- tests/ffi/abi_specific_int_test.dart | 6 +- tests/ffi/coordinate.dart | 2 +- tests/ffi/coordinate_nnbd_workaround.dart | 2 +- tests/ffi/expando_test.dart | 2 +- tests/ffi/extension_methods_test.dart | 4 +- ..._structs_by_value_generated_compounds.dart | 134 +++++++++--------- tests/ffi/function_varargs_name_test.dart | 2 +- tests/ffi/native_effect_test.dart | 2 +- tests/ffi/regress_43016_test.dart | 2 +- tests/ffi/regress_43693_test.dart | 2 +- tests/ffi/regress_44985_test.dart | 2 +- tests/ffi/regress_44986_test.dart | 2 +- tests/ffi/regress_45189_test.dart | 2 +- tests/ffi/regress_45198_test.dart | 2 +- tests/ffi/regress_45507_test.dart | 2 +- tests/ffi/regress_45988_test.dart | 2 +- tests/ffi/regress_46004_test.dart | 2 +- tests/ffi/regress_46085_test.dart | 2 +- tests/ffi/regress_46127_test.dart | 2 +- tests/ffi/regress_47673_2_test.dart | 2 +- tests/ffi/regress_47673_test.dart | 2 +- tests/ffi/regress_51041_test.dart | 2 +- tests/ffi/regress_51315_test.dart | 2 +- tests/ffi/regress_51321_test.dart | 2 +- tests/ffi/regress_jump_to_frame_test.dart | 4 +- tests/ffi/structs_nested_test.dart | 4 +- tests/ffi/very_large_struct.dart | 2 +- tests/ffi/vmspecific_regress_37100_test.dart | 2 +- tests/ffi/vmspecific_regress_38993_test.dart | 2 +- tests/ffi/vmspecific_static_checks_test.dart | 70 ++++----- tests/standalone/io/socket_sigpipe_test.dart | 2 +- .../standalone_2/io/socket_sigpipe_test.dart | 2 + tests/web/wasm/ffi_native_test.dart | 2 +- tools/verify_docs/bin/verify_docs.dart | 2 +- 172 files changed, 824 insertions(+), 748 deletions(-) diff --git a/benchmarks/FfiBoringssl/dart/types.dart b/benchmarks/FfiBoringssl/dart/types.dart index 972555e105e..22a622bd821 100644 --- a/benchmarks/FfiBoringssl/dart/types.dart +++ b/benchmarks/FfiBoringssl/dart/types.dart @@ -7,13 +7,13 @@ import 'dart:ffi'; /// digest algorithm. -class EVP_MD extends Opaque {} +final class EVP_MD extends Opaque {} /// digest context. -class EVP_MD_CTX extends Opaque {} +final class EVP_MD_CTX extends Opaque {} /// Type for `void*` used to represent opaque data. -class Data extends Opaque { +final class Data extends Opaque { static Pointer fromUint8Pointer(Pointer p) => p.cast(); } @@ -22,7 +22,7 @@ extension DataPointerAsUint8Pointer on Pointer { } /// Type for `uint8_t*` used to represent byte data. -class Bytes extends Opaque { +final class Bytes extends Opaque { static Pointer fromUint8Pointer(Pointer p) => p.cast(); } diff --git a/benchmarks/FfiStruct/dart/FfiStruct.dart b/benchmarks/FfiStruct/dart/FfiStruct.dart index 4fbc61ca769..ced6243701c 100644 --- a/benchmarks/FfiStruct/dart/FfiStruct.dart +++ b/benchmarks/FfiStruct/dart/FfiStruct.dart @@ -80,7 +80,7 @@ void main() { // // Test struct. // -class VeryLargeStruct extends Struct { +final class VeryLargeStruct extends Struct { @Int8() external int a; diff --git a/benchmarks/FfiStructCopy/dart/benchmark_generated.dart b/benchmarks/FfiStructCopy/dart/benchmark_generated.dart index bdfc4df4511..f9a8ae785a6 100644 --- a/benchmarks/FfiStructCopy/dart/benchmark_generated.dart +++ b/benchmarks/FfiStructCopy/dart/benchmark_generated.dart @@ -8,16 +8,16 @@ import 'package:ffi/ffi.dart'; import 'FfiStructCopy.dart'; -class Struct1Bytes extends Struct { +final class Struct1Bytes extends Struct { @Array(1) external Array a0; } -class Struct1BytesWrapper extends Struct { +final class Struct1BytesWrapper extends Struct { external Struct1Bytes nested; } -class Copy1Bytes extends StructCopyBenchmark { +final class Copy1Bytes extends StructCopyBenchmark { @override Pointer from = nullptr; @override @@ -42,16 +42,16 @@ class Copy1Bytes extends StructCopyBenchmark { } } -class Struct32Bytes extends Struct { +final class Struct32Bytes extends Struct { @Array(32) external Array a0; } -class Struct32BytesWrapper extends Struct { +final class Struct32BytesWrapper extends Struct { external Struct32Bytes nested; } -class Copy32Bytes extends StructCopyBenchmark { +final class Copy32Bytes extends StructCopyBenchmark { @override Pointer from = nullptr; @override @@ -76,16 +76,16 @@ class Copy32Bytes extends StructCopyBenchmark { } } -class Struct1024Bytes extends Struct { +final class Struct1024Bytes extends Struct { @Array(1024) external Array a0; } -class Struct1024BytesWrapper extends Struct { +final class Struct1024BytesWrapper extends Struct { external Struct1024Bytes nested; } -class Copy1024Bytes extends StructCopyBenchmark { +final class Copy1024Bytes extends StructCopyBenchmark { @override Pointer from = nullptr; @override @@ -110,16 +110,16 @@ class Copy1024Bytes extends StructCopyBenchmark { } } -class Struct32768Bytes extends Struct { +final class Struct32768Bytes extends Struct { @Array(32768) external Array a0; } -class Struct32768BytesWrapper extends Struct { +final class Struct32768BytesWrapper extends Struct { external Struct32768Bytes nested; } -class Copy32768Bytes extends StructCopyBenchmark { +final class Copy32768Bytes extends StructCopyBenchmark { @override Pointer from = nullptr; @override diff --git a/benchmarks/FfiStructCopy/generate_benchmarks.dart b/benchmarks/FfiStructCopy/generate_benchmarks.dart index 560ef3d285f..77f40e68703 100644 --- a/benchmarks/FfiStructCopy/generate_benchmarks.dart +++ b/benchmarks/FfiStructCopy/generate_benchmarks.dart @@ -35,16 +35,16 @@ import 'FfiStructCopy.dart'; '''; String generateSize(int size) => ''' -class Struct${size}Bytes extends Struct { +final class Struct${size}Bytes extends Struct { @Array($size) external Array a0; } -class Struct${size}BytesWrapper extends Struct { +final class Struct${size}BytesWrapper extends Struct { external Struct${size}Bytes nested; } -class Copy${size}Bytes extends StructCopyBenchmark { +final class Copy${size}Bytes extends StructCopyBenchmark { @override Pointer from = nullptr; @override diff --git a/pkg/analysis_server/test/services/completion/dart/location/relational_pattern_test.dart b/pkg/analysis_server/test/services/completion/dart/location/relational_pattern_test.dart index 9b038a542d3..a786225fb28 100644 --- a/pkg/analysis_server/test/services/completion/dart/location/relational_pattern_test.dart +++ b/pkg/analysis_server/test/services/completion/dart/location/relational_pattern_test.dart @@ -103,17 +103,17 @@ class B01 {} assertResponse(''' suggestions A01 - kind: constructorInvocation + kind: class A01 - kind: class - A02 kind: constructorInvocation A02 kind: class - B01 - kind: class + A02 + kind: constructorInvocation B01 kind: constructorInvocation + B01 + kind: class const kind: keyword dynamic diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart index a607a4a82c8..a331378dca5 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart @@ -207,12 +207,16 @@ class SubtypeOfFfiClassInExtendsTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class C extends Double {} +final class C extends Double {} '''); - await assertHasFix(''' + await assertHasFix( + ''' import 'dart:ffi'; -class C {} -'''); +final class C {} +''', + errorFilter: (error) => + error.errorCode == FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, + ); } } @@ -224,12 +228,16 @@ class SubtypeOfFfiClassInImplementsTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class C implements Double {} +final class C implements Double {} '''); - await assertHasFix(''' + await assertHasFix( + ''' import 'dart:ffi'; -class C {} -'''); +final class C {} +''', + errorFilter: (error) => + error.errorCode == FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, + ); } } @@ -241,11 +249,11 @@ class SubtypeOfFfiClassInWithTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class C with Double {} +final class C with Double {} '''); await assertHasFix(''' import 'dart:ffi'; -class C {} +final class C {} ''', errorFilter: (error) => error.errorCode == FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH); @@ -260,17 +268,17 @@ class SubtypeOfStructClassInExtendsTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } -class C extends S {} +final class C extends S {} '''); await assertHasFix(''' import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } -class C {} +final class C {} '''); } } @@ -283,12 +291,16 @@ class SubtypeOfStructClassInImplementsTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class C implements Struct {} +final class C implements Struct {} '''); - await assertHasFix(''' + await assertHasFix( + ''' import 'dart:ffi'; -class C {} -'''); +final class C {} +''', + errorFilter: (error) => + error.errorCode == FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, + ); } } @@ -300,15 +312,17 @@ class SubtypeOfStructClassInWithTest extends FixProcessorTest { Future test_oneName() async { await resolveTestCode(''' import 'dart:ffi'; -class S extends Struct {} -class C with S {} +final class S extends Struct {} +final class C with S {} '''); - await assertHasFix(''' + await assertHasFix( + ''' import 'dart:ffi'; -class S extends Struct {} -class C {} +final class S extends Struct {} +final class C {} ''', - errorFilter: (error) => - error.errorCode == FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH); + errorFilter: (error) => + error.errorCode == FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, + ); } } diff --git a/pkg/analyzer/lib/src/test_utilities/mock_packages.dart b/pkg/analyzer/lib/src/test_utilities/mock_packages.dart index 6dd9139d13a..abe0097f8e4 100644 --- a/pkg/analyzer/lib/src/test_utilities/mock_packages.dart +++ b/pkg/analyzer/lib/src/test_utilities/mock_packages.dart @@ -20,7 +20,7 @@ abstract class Allocator { void free(Pointer pointer); } -class Utf8 extends Opaque {} +final class Utf8 extends Opaque {} class _CallocAllocator implements Allocator { @override diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart index c6c6ee04f2f..3fc6327d3d7 100644 --- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart +++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart @@ -708,63 +708,63 @@ final MockSdkLibrary _LIB_FFI = MockSdkLibrary('ffi', [ @Since('2.6') library dart.ffi; -class NativeType { +final class NativeType { const NativeType(); } @Since('2.9') -class Handle extends NativeType {} +abstract final class Handle extends NativeType {} @Since('2.12') -abstract class Opaque extends NativeType {} +abstract base class Opaque extends NativeType {} -class Void extends NativeType {} +final class Void extends NativeType {} -class Int8 extends NativeType { +final class Int8 extends NativeType { const Int8(); } -class Uint8 extends NativeType { +final class Uint8 extends NativeType { const Uint8(); } -class Int16 extends NativeType { +final class Int16 extends NativeType { const Int16(); } -class Uint16 extends NativeType { +final class Uint16 extends NativeType { const Uint16(); } -class Int32 extends NativeType { +final class Int32 extends NativeType { const Int32(); } -class Uint32 extends NativeType { +final class Uint32 extends NativeType { const Uint32(); } -class Int64 extends NativeType { +final class Int64 extends NativeType { const Int64(); } -class Uint64 extends NativeType { +final class Uint64 extends NativeType { const Uint64(); } -class Float extends NativeType { +final class Float extends NativeType { const Float(); } -class Double extends NativeType { +final class Double extends NativeType { const Double(); } -class IntPtr extends NativeType { +final class IntPtr extends NativeType { const IntPtr(); } -class Pointer extends NativeType { +final class Pointer extends NativeType { external factory Pointer.fromAddress(int ptr); static Pointer> fromFunction( @@ -779,22 +779,22 @@ extension NativeFunctionPointer external DF asFunction({bool isLeaf = false}); } -class _Compound extends NativeType {} +final class _Compound extends NativeType {} @Since('2.12') -class Struct extends _Compound {} +base class Struct extends _Compound {} @Since('2.14') -class Union extends _Compound {} +base class Union extends _Compound {} @Since('2.13') -class Packed { +final class Packed { final int memberAlignment; const Packed(this.memberAlignment); } -abstract class DynamicLibrary { +abstract final class DynamicLibrary { external factory DynamicLibrary.open(String name); } @@ -803,14 +803,14 @@ extension DynamicLibraryExtension on DynamicLibrary { String symbolName, {bool isLeaf:false}); } -abstract class NativeFunction extends NativeType {} +abstract final class NativeFunction extends NativeType {} -class DartRepresentationOf { +final class DartRepresentationOf { const DartRepresentationOf(String nativeType); } @Since('2.13') -class Array extends NativeType { +final class Array extends NativeType { const factory Array(int dimension1, [int dimension2, int dimension3, @@ -820,7 +820,7 @@ class Array extends NativeType { const factory Array.multi(List dimensions) = _ArraySize.multi; } -class _ArraySize implements Array { +final class _ArraySize implements Array { final int? dimension1; final int? dimension2; final int? dimension3; @@ -847,14 +847,14 @@ extension StructPointer on Pointer { external T operator [](int index); } -class FfiNative { +final class FfiNative { final String nativeName; final bool isLeaf; const FfiNative(this.nativeName, {this.isLeaf = false}); } @Since('2.19') -class Native { +final class Native { final String? symbol; final String? asset; final bool isLeaf; @@ -866,12 +866,12 @@ class Native { }); } -class Asset { +final class Asset { final String asset; const Asset(this.asset); } -class Abi { +final class Abi { static const androidArm = _androidArm; static const androidArm64 = _androidArm64; static const androidIA32 = _androidIA32; @@ -908,24 +908,24 @@ enum _OS { } @Since('2.16') -class AbiSpecificInteger extends NativeType { +base class AbiSpecificInteger extends NativeType { const AbiSpecificInteger(); } @Since('2.16') -class AbiSpecificIntegerMapping { +final class AbiSpecificIntegerMapping { final Map mapping; const AbiSpecificIntegerMapping(this.mapping); } @Since('2.17') -abstract class Finalizable { +abstract interface class Finalizable { factory Finalizable._() => throw UnsupportedError(""); } @Since('3.0') -abstract class VarArgs extends NativeType {} +abstract final class VarArgs extends NativeType {} ''', ) ]); diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index 932b5b648fe..1f61303108a 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -17530,7 +17530,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class [!C!] extends AbiSpecificInteger { + final class [!C!] extends AbiSpecificInteger { } ``` @@ -17541,7 +17541,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class [!C!] extends AbiSpecificInteger { + final class [!C!] extends AbiSpecificInteger { C(); } ``` @@ -17553,7 +17553,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class [!C!] extends AbiSpecificInteger { + final class [!C!] extends AbiSpecificInteger { const C.zero(); const C.one(); } @@ -17566,7 +17566,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class [!C!] extends AbiSpecificInteger { + final class [!C!] extends AbiSpecificInteger { final int i; const C(this.i); @@ -17580,7 +17580,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class [!C!] extends AbiSpecificInteger { // type parameters + final class [!C!] extends AbiSpecificInteger { // type parameters const C(); } ``` @@ -17594,7 +17594,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17620,7 +17620,7 @@ FfiCode: @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) @[!AbiSpecificIntegerMapping!]({Abi.linuxX64 : Uint16()}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17634,7 +17634,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8(), Abi.linuxX64 : Uint16()}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17658,7 +17658,7 @@ FfiCode: ```dart import 'dart:ffi'; - class [!C!] extends AbiSpecificInteger { + final class [!C!] extends AbiSpecificInteger { const C(); } ``` @@ -17671,7 +17671,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17706,7 +17706,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : [!Array(4)!]}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17719,7 +17719,7 @@ FfiCode: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) - class C extends AbiSpecificInteger { + final class C extends AbiSpecificInteger { const C(); } ``` @@ -17746,7 +17746,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { [!@Double()!] external Pointer p; } @@ -17759,7 +17759,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { external Pointer p; } ``` @@ -17844,7 +17844,7 @@ FfiCode: ```dart import 'dart:ffi'; - class [!S!] extends Struct implements Finalizable { + final class [!S!] extends Struct implements Finalizable { external Pointer notEmpty; } ``` @@ -17856,7 +17856,7 @@ FfiCode: ```dart import 'dart:ffi'; - class S extends Struct { + final class S extends Struct { external Pointer notEmpty; } ``` @@ -17881,7 +17881,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() external int a; } @@ -17900,7 +17900,7 @@ FfiCode: import 'dart:ffi'; import 'package:ffi/ffi.dart'; - class C extends Struct { + final class C extends Struct { @Int32() external int a; } @@ -17937,7 +17937,7 @@ FfiCode: ```dart import 'dart:ffi'; - class [!C!] extends Struct {} + final class [!C!] extends Struct {} ``` #### Common fixes @@ -17947,7 +17947,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() external int x; } @@ -17959,7 +17959,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Opaque {} + final class C extends Opaque {} ``` If the class isn't intended to be a struct, then remove or change the @@ -17990,7 +17990,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() [!@Int16()!] external int x; @@ -18003,7 +18003,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() external int x; } @@ -18030,7 +18030,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(4) [!@Array(8)!] external Array a0; @@ -18044,7 +18044,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8) external Array a0; } @@ -18093,7 +18093,7 @@ FfiCode: // @dart = 2.9 import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() int f; @@ -18109,7 +18109,7 @@ FfiCode: // @dart = 2.9 import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() int f; @@ -18138,7 +18138,7 @@ FfiCode: // @dart = 2.9 import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { Pointer [!p!] = nullptr; } ``` @@ -18151,7 +18151,7 @@ FfiCode: // @dart = 2.9 import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { Pointer p; } ``` @@ -18176,7 +18176,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int16() int [!a!]; } @@ -18189,7 +18189,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int16() external int a; } @@ -18217,7 +18217,7 @@ FfiCode: ```dart import 'dart:ffi'; - class [!S!] extends Struct { + final class [!S!] extends Struct { external Pointer notEmpty; } ``` @@ -18229,7 +18229,7 @@ FfiCode: ```dart import 'dart:ffi'; - class S extends Struct { + final class S extends Struct { external Pointer notEmpty; } ``` @@ -18305,7 +18305,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { external [!String!] s; @Int32() @@ -18321,7 +18321,7 @@ FfiCode: import 'dart:ffi'; import 'package:ffi/ffi.dart'; - class C extends Struct { + final class C extends Struct { external Pointer s; @Int32() @@ -18457,7 +18457,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { [!@Double()!] external int x; } @@ -18470,7 +18470,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() external int x; } @@ -18481,7 +18481,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Double() external double x; } @@ -18513,7 +18513,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { external [!int!] x; } ``` @@ -18525,7 +18525,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int64() external int x; } @@ -18597,7 +18597,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { external var [!str!]; @Int32() @@ -18613,7 +18613,7 @@ FfiCode: import 'dart:ffi'; import 'package:ffi/ffi.dart'; - class C extends Struct { + final class C extends Struct { external Pointer str; @Int32() @@ -18642,7 +18642,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { external [!Array!] a0; } ``` @@ -18654,7 +18654,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8) external Array a0; } @@ -18897,7 +18897,7 @@ FfiCode: ```dart import 'dart:ffi'; - class MyStruct extends Struct { + final class MyStruct extends Struct { @Array([!-8!]) external Array a0; } @@ -18910,7 +18910,7 @@ FfiCode: ```dart import 'dart:ffi'; - class MyStruct extends Struct { + final class MyStruct extends Struct { @Array(8) external Array a0; } @@ -18941,7 +18941,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8) external Array<[!Void!]> a0; } @@ -18954,7 +18954,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8) external Array a0; } @@ -18982,7 +18982,7 @@ FfiCode: @Packed(1) [!@Packed(1)!] - class C extends Struct { + final class C extends Struct { external Pointer notEmpty; } ``` @@ -18995,7 +18995,7 @@ FfiCode: import 'dart:ffi'; @Packed(1) - class C extends Struct { + final class C extends Struct { external Pointer notEmpty; } ``` @@ -19021,7 +19021,7 @@ FfiCode: import 'dart:ffi'; @Packed([!3!]) - class C extends Struct { + final class C extends Struct { external Pointer notEmpty; } ``` @@ -19034,7 +19034,7 @@ FfiCode: import 'dart:ffi'; @Packed(4) - class C extends Struct { + final class C extends Struct { external Pointer notEmpty; } ``` @@ -19061,7 +19061,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { [!@Array(8, 8)!] external Array>> a0; } @@ -19075,7 +19075,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8, 8, 4) external Array>> a0; } @@ -19086,7 +19086,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Array(8, 8) external Array> a0; } @@ -19118,7 +19118,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends [!Double!] {} + final class C extends [!Double!] {} ``` #### Common fixes @@ -19129,7 +19129,7 @@ FfiCode: ```dart import 'dart:ffi'; - class C extends Struct { + final class C extends Struct { @Int32() external int i; } @@ -19139,7 +19139,7 @@ FfiCode: references to FFI classes: ```dart - class C {} + final class C {} ``` SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS: sharedName: SUBTYPE_OF_FFI_CLASS @@ -19185,11 +19185,11 @@ FfiCode: ```dart import 'dart:ffi'; - class S extends Struct { + final class S extends Struct { external Pointer f; } - class C extends [!S!] { + final class C extends [!S!] { external Pointer g; } ``` @@ -19203,11 +19203,11 @@ FfiCode: ```dart import 'dart:ffi'; - class S extends Struct { + final class S extends Struct { external Pointer f; } - class C extends Struct { + final class C extends Struct { external Pointer f; external Pointer g; diff --git a/pkg/analyzer/test/src/diagnostics/abi_specific_integer_mapping_test.dart b/pkg/analyzer/test/src/diagnostics/abi_specific_integer_mapping_test.dart index 485e512aae5..6f65222ab2f 100644 --- a/pkg/analyzer/test/src/diagnostics/abi_specific_integer_mapping_test.dart +++ b/pkg/analyzer/test/src/diagnostics/abi_specific_integer_mapping_test.dart @@ -20,7 +20,7 @@ class AbiSpecificIntegerMappingTest extends PubPackageResolutionTest { import 'dart:ffi'; @AbiSpecificIntegerMapping({}) @AbiSpecificIntegerMapping({}) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } ''', [ @@ -36,7 +36,7 @@ import 'dart:ffi'; Abi.androidArm64: IntPtr(), Abi.androidIA32: UintPtr(), }) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } ''', [ @@ -56,7 +56,7 @@ const c = { Abi.androidIA32: UintPtr(), }; @AbiSpecificIntegerMapping(c) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } ''', [ @@ -70,11 +70,11 @@ class UintPtr extends AbiSpecificInteger { test_noMapping() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } ''', [ - error(FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_MISSING, 25, 7), + error(FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_MISSING, 31, 7), ]); } @@ -82,7 +82,7 @@ class UintPtr extends AbiSpecificInteger { await assertNoErrorsInCode(r''' import 'dart:ffi'; @AbiSpecificIntegerMapping({}) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } '''); @@ -96,7 +96,7 @@ import 'dart:ffi'; Abi.androidArm64: Uint64(), Abi.androidIA32: Uint32(), }) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } '''); diff --git a/pkg/analyzer/test/src/diagnostics/annotation_on_pointer_field_test.dart b/pkg/analyzer/test/src/diagnostics/annotation_on_pointer_field_test.dart index 1572e372678..29b1e0fe9f9 100644 --- a/pkg/analyzer/test/src/diagnostics/annotation_on_pointer_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/annotation_on_pointer_field_test.dart @@ -18,24 +18,24 @@ class AnnotationOnPointerFieldTest extends PubPackageResolutionTest { test_double() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Double() external Pointer x; } ''', [ - error(FfiCode.ANNOTATION_ON_POINTER_FIELD, 46, 9), + error(FfiCode.ANNOTATION_ON_POINTER_FIELD, 52, 9), ]); } test_int32() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external Pointer x; } ''', [ - error(FfiCode.ANNOTATION_ON_POINTER_FIELD, 46, 8), + error(FfiCode.ANNOTATION_ON_POINTER_FIELD, 52, 8), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart b/pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart index 94758d6aed6..22c5f1a7edd 100644 --- a/pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart +++ b/pkg/analyzer/test/src/diagnostics/creation_of_struct_or_union_test.dart @@ -19,7 +19,7 @@ class CreationOfStructOrUnionTest extends PubPackageResolutionTest { await assertErrorsInCode(r''' import 'dart:ffi'; -class A extends Struct { +final class A extends Struct { @Int32() external int a; } @@ -28,7 +28,7 @@ void f() { A(); } ''', [ - error(FfiCode.CREATION_OF_STRUCT_OR_UNION, 90, 1), + error(FfiCode.CREATION_OF_STRUCT_OR_UNION, 96, 1), ]); } @@ -36,7 +36,7 @@ void f() { await assertErrorsInCode(r''' import 'dart:ffi'; -class A extends Union { +final class A extends Union { @Int32() external int a; } @@ -45,7 +45,7 @@ void f() { A(); } ''', [ - error(FfiCode.CREATION_OF_STRUCT_OR_UNION, 89, 1), + error(FfiCode.CREATION_OF_STRUCT_OR_UNION, 95, 1), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/extra_annotation_on_struct_field_test.dart b/pkg/analyzer/test/src/diagnostics/extra_annotation_on_struct_field_test.dart index 15f5566ae62..b4138bb4fac 100644 --- a/pkg/analyzer/test/src/diagnostics/extra_annotation_on_struct_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/extra_annotation_on_struct_field_test.dart @@ -18,7 +18,7 @@ class ExtraAnnotationOnStructFieldTest extends PubPackageResolutionTest { test_one() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int x; } @@ -28,13 +28,13 @@ class C extends Struct { test_two() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() @Int16() external int x; } ''', [ - error(FfiCode.EXTRA_ANNOTATION_ON_STRUCT_FIELD, 57, 8), + error(FfiCode.EXTRA_ANNOTATION_ON_STRUCT_FIELD, 63, 8), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/extra_size_annotation_carray_test.dart b/pkg/analyzer/test/src/diagnostics/extra_size_annotation_carray_test.dart index cbc97486c71..9764893c57a 100644 --- a/pkg/analyzer/test/src/diagnostics/extra_size_annotation_carray_test.dart +++ b/pkg/analyzer/test/src/diagnostics/extra_size_annotation_carray_test.dart @@ -21,7 +21,7 @@ import 'dart:ffi'; const EIGHT = 8; -class Struct8BytesInlineArrayInt extends Struct { +final class Struct8BytesInlineArrayInt extends Struct { @Array(EIGHT) external Array a0; } @@ -32,7 +32,7 @@ class Struct8BytesInlineArrayInt extends Struct { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } @@ -43,13 +43,13 @@ class C extends Struct { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) @Array(8) external Array a0; } ''', [ - error(FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY, 59, 9), + error(FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY, 65, 9), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/field_must_be_external_in_struct_test.dart b/pkg/analyzer/test/src/diagnostics/field_must_be_external_in_struct_test.dart index d03d1b900ea..90df05395cd 100644 --- a/pkg/analyzer/test/src/diagnostics/field_must_be_external_in_struct_test.dart +++ b/pkg/analyzer/test/src/diagnostics/field_must_be_external_in_struct_test.dart @@ -20,13 +20,14 @@ class FieldMustBeExternalInStructTest extends PubPackageResolutionTest mixin FieldMustBeExternalInStructTestCases on PubPackageResolutionTest { test_struct() async { + final keyword = isNullSafetyEnabled ? 'final ' : ''; var expectedErrors = expectedErrorsByNullability(nullable: [ - error(FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT, 62, 1), + error(FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT, 68, 1), ], legacy: []); - await assertErrorsInCode(r''' + await assertErrorsInCode(''' import 'dart:ffi'; -class A extends Struct { +${keyword}class A extends Struct { @Int16() int a; } @@ -34,13 +35,14 @@ class A extends Struct { } test_union() async { + final keyword = isNullSafetyEnabled ? 'final ' : ''; var expectedErrors = expectedErrorsByNullability(nullable: [ - error(FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT, 61, 1), + error(FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT, 67, 1), ], legacy: []); - await assertErrorsInCode(r''' + await assertErrorsInCode(''' import 'dart:ffi'; -class A extends Union { +${keyword}class A extends Union { @Int16() int a; } diff --git a/pkg/analyzer/test/src/diagnostics/generic_struct_subclass_test.dart b/pkg/analyzer/test/src/diagnostics/generic_struct_subclass_test.dart index f154d5dce00..e2b78e76df1 100644 --- a/pkg/analyzer/test/src/diagnostics/generic_struct_subclass_test.dart +++ b/pkg/analyzer/test/src/diagnostics/generic_struct_subclass_test.dart @@ -18,29 +18,29 @@ class GenericStructSubclassTest extends PubPackageResolutionTest { test_genericStruct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } ''', [ - error(FfiCode.GENERIC_STRUCT_SUBCLASS, 25, 1, messageContains: ["'S'"]), + error(FfiCode.GENERIC_STRUCT_SUBCLASS, 31, 1, messageContains: ["'S'"]), ]); } test_genericUnion() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Union { +final class S extends Union { external Pointer notEmpty; } ''', [ - error(FfiCode.GENERIC_STRUCT_SUBCLASS, 25, 1, messageContains: ["'S'"]), + error(FfiCode.GENERIC_STRUCT_SUBCLASS, 31, 1, messageContains: ["'S'"]), ]); } test_validStruct() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } '''); diff --git a/pkg/analyzer/test/src/diagnostics/invalid_field_type_in_struct_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_field_type_in_struct_test.dart index e3039530602..ee6d73e8fc4 100644 --- a/pkg/analyzer/test/src/diagnostics/invalid_field_type_in_struct_test.dart +++ b/pkg/analyzer/test/src/diagnostics/invalid_field_type_in_struct_test.dart @@ -19,13 +19,13 @@ class InvalidFieldTypeInStructTest extends PubPackageResolutionTest { test_instance_invalid() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external String str; external Pointer notEmpty; } ''', [ - error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 55, 6), + error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 61, 6), ]); } @@ -33,31 +33,31 @@ class C extends Struct { test_instance_invalid2() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Union { +final class C extends Union { external String str; external Pointer notEmpty; } ''', [ - error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 54, 6), + error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 60, 6), ]); } test_instance_invalid3() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer? p; } ''', [ - error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 55, 8), + error(FfiCode.INVALID_FIELD_TYPE_IN_STRUCT, 61, 8), ]); } test_instance_valid() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer p; } '''); @@ -66,7 +66,7 @@ class C extends Struct { test_static() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { static String? str; external Pointer notEmpty; diff --git a/pkg/analyzer/test/src/diagnostics/mismatched_annotation_on_struct_field_test.dart b/pkg/analyzer/test/src/diagnostics/mismatched_annotation_on_struct_field_test.dart index bca3f8d7655..40e54471bb5 100644 --- a/pkg/analyzer/test/src/diagnostics/mismatched_annotation_on_struct_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/mismatched_annotation_on_struct_field_test.dart @@ -18,24 +18,24 @@ class MismatchedAnnotationOnStructFieldTest extends PubPackageResolutionTest { test_double_on_int() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Double() external int x; } ''', [ - error(FfiCode.MISMATCHED_ANNOTATION_ON_STRUCT_FIELD, 46, 9), + error(FfiCode.MISMATCHED_ANNOTATION_ON_STRUCT_FIELD, 52, 9), ]); } test_int32_on_double() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external double x; } ''', [ - error(FfiCode.MISMATCHED_ANNOTATION_ON_STRUCT_FIELD, 46, 8), + error(FfiCode.MISMATCHED_ANNOTATION_ON_STRUCT_FIELD, 52, 8), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/missing_annotation_on_struct_field_test.dart b/pkg/analyzer/test/src/diagnostics/missing_annotation_on_struct_field_test.dart index 3fe5ebacfde..184ce75612a 100644 --- a/pkg/analyzer/test/src/diagnostics/missing_annotation_on_struct_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/missing_annotation_on_struct_field_test.dart @@ -18,18 +18,18 @@ class MissingAnnotationOnStructFieldTest extends PubPackageResolutionTest { test_missing_int() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external int x; } ''', [ - error(FfiCode.MISSING_ANNOTATION_ON_STRUCT_FIELD, 55, 3), + error(FfiCode.MISSING_ANNOTATION_ON_STRUCT_FIELD, 61, 3), ]); } test_notMissing() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int x; } diff --git a/pkg/analyzer/test/src/diagnostics/missing_field_type_in_struct_test.dart b/pkg/analyzer/test/src/diagnostics/missing_field_type_in_struct_test.dart index 08937afb31b..8ee81332e8f 100644 --- a/pkg/analyzer/test/src/diagnostics/missing_field_type_in_struct_test.dart +++ b/pkg/analyzer/test/src/diagnostics/missing_field_type_in_struct_test.dart @@ -18,20 +18,20 @@ class MissingFieldTypeInStructTest extends PubPackageResolutionTest { test_missing() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external var str; external Pointer notEmpty; } ''', [ - error(FfiCode.MISSING_FIELD_TYPE_IN_STRUCT, 59, 3), + error(FfiCode.MISSING_FIELD_TYPE_IN_STRUCT, 65, 3), ]); } test_valid() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer p; } '''); diff --git a/pkg/analyzer/test/src/diagnostics/missing_size_annotation_carray_test.dart b/pkg/analyzer/test/src/diagnostics/missing_size_annotation_carray_test.dart index e424fc84a2d..e74c5c4bd6c 100644 --- a/pkg/analyzer/test/src/diagnostics/missing_size_annotation_carray_test.dart +++ b/pkg/analyzer/test/src/diagnostics/missing_size_annotation_carray_test.dart @@ -19,7 +19,7 @@ class MissingSizeAnnotationArray extends PubPackageResolutionTest { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } @@ -30,11 +30,11 @@ class C extends Struct { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Array a0; } ''', [ - error(FfiCode.MISSING_SIZE_ANNOTATION_CARRAY, 56, 12), + error(FfiCode.MISSING_SIZE_ANNOTATION_CARRAY, 62, 12), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart index b51176c3382..15deeee062d 100644 --- a/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart +++ b/pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart @@ -37,7 +37,7 @@ class NonConstantTypeArgumentWarningTest extends PubPackageResolutionTest { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Uint8() external int myField; } @@ -53,7 +53,7 @@ void main() { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Uint8() external int myField; } diff --git a/pkg/analyzer/test/src/diagnostics/non_positive_array_dimension_test.dart b/pkg/analyzer/test/src/diagnostics/non_positive_array_dimension_test.dart index a7b26bbe10c..c9e311f20b7 100644 --- a/pkg/analyzer/test/src/diagnostics/non_positive_array_dimension_test.dart +++ b/pkg/analyzer/test/src/diagnostics/non_positive_array_dimension_test.dart @@ -19,12 +19,12 @@ class NonPositiveArrayDimensionTest extends PubPackageResolutionTest { await assertErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array.multi([-1]) external Array a0; } ''', [ - error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 68, 2), + error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 74, 2), ]); } @@ -32,12 +32,12 @@ class MyStruct extends Struct { await assertErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array.multi([1, 2, 3, -4, 5, 6]) external Array>>>>> a0; } ''', [ - error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 77, 2), + error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 83, 2), ]); } @@ -45,7 +45,7 @@ class MyStruct extends Struct { await assertNoErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array.multi([1]) external Array a0; } @@ -56,12 +56,12 @@ class MyStruct extends Struct { await assertErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array.multi([0]) external Array a0; } ''', [ - error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 68, 1), + error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 74, 1), ]); } @@ -69,12 +69,12 @@ class MyStruct extends Struct { await assertErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array(-12) external Array a0; } ''', [ - error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 61, 3), + error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 67, 3), ]); } @@ -82,7 +82,7 @@ class MyStruct extends Struct { await assertNoErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array(1) external Array a0; } @@ -93,12 +93,12 @@ class MyStruct extends Struct { await assertErrorsInCode(''' import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array(0) external Array a0; } ''', [ - error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 61, 1), + error(FfiCode.NON_POSITIVE_ARRAY_DIMENSION, 67, 1), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart index ca3c9b54a3b..15eb073bc20 100644 --- a/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart +++ b/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart @@ -19,12 +19,12 @@ class NonSizedTypeArgument extends PubPackageResolutionTest { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } ''', [ - error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 74, 4), + error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 80, 4), ]); } @@ -32,12 +32,12 @@ class C extends Struct { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Union { +final class C extends Union { @Array(8) external Array a0; } ''', [ - error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 73, 4), + error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 79, 4), ]); } @@ -45,7 +45,7 @@ class C extends Union { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } diff --git a/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart b/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart index df90e0a28aa..4f2b9f7ad1b 100644 --- a/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart +++ b/pkg/analyzer/test/src/diagnostics/not_initialized_non_nullable_instance_field_test.dart @@ -49,7 +49,7 @@ class A { await assertNoErrorsInCode(''' import 'dart:ffi'; -class A extends Struct { +final class A extends Struct { @Double() external double foo; } diff --git a/pkg/analyzer/test/src/diagnostics/packed_annotation_alignment_test.dart b/pkg/analyzer/test/src/diagnostics/packed_annotation_alignment_test.dart index 04410750df1..aa38b9bcd08 100644 --- a/pkg/analyzer/test/src/diagnostics/packed_annotation_alignment_test.dart +++ b/pkg/analyzer/test/src/diagnostics/packed_annotation_alignment_test.dart @@ -20,7 +20,7 @@ class PackedAnnotationAlignment extends PubPackageResolutionTest { import 'dart:ffi'; @Packed(3) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } ''', [ @@ -33,7 +33,7 @@ class C extends Struct { import 'dart:ffi'; @Packed(1) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } '''); diff --git a/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart b/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart index 016d1075ad6..44e52e7b243 100644 --- a/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart +++ b/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart @@ -22,7 +22,7 @@ import 'dart:ffi'; @Packed(1) @Packed(1) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } ''', [ @@ -36,7 +36,7 @@ class C extends Struct { import 'dart:ffi'; @Packed() -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } ''', [ @@ -50,7 +50,7 @@ class C extends Struct { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } '''); @@ -61,7 +61,7 @@ class C extends Struct { import 'dart:ffi'; @Packed(1) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } '''); @@ -72,7 +72,7 @@ class C extends Struct { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Union { +final class C extends Union { external Pointer notEmpty; } '''); @@ -84,7 +84,7 @@ class C extends Union { import 'dart:ffi'; @Packed(1) -class C extends Union { +final class C extends Union { external Pointer notEmpty; } '''); @@ -97,7 +97,7 @@ import 'dart:ffi'; @Packed(1) @Packed(1) -class C extends Union { +final class C extends Union { external Pointer notEmpty; } '''); diff --git a/pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart b/pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart index 7bc69496d5e..39940ae9885 100644 --- a/pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart +++ b/pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart @@ -19,12 +19,12 @@ class SizeAnnotationDimensions extends PubPackageResolutionTest { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8, 8) external Array>> a0; } ''', [ - error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 47, 12), + error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 53, 12), ]); } @@ -32,12 +32,12 @@ class C extends Struct { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8, 8, 8) external Array> a0; } ''', [ - error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 47, 15), + error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 53, 15), ]); } @@ -45,12 +45,12 @@ class C extends Struct { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array.multi([8, 8]) external Array>> a0; } ''', [ - error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 47, 20), + error(FfiCode.SIZE_ANNOTATION_DIMENSIONS, 53, 20), ]); } @@ -58,7 +58,7 @@ class C extends Struct { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8, 8) external Array> a0; } diff --git a/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart b/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart index 968dd969f0a..d731188939d 100644 --- a/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart +++ b/pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart @@ -21,9 +21,11 @@ class SubtypeOfFfiClassInExtendsTest extends PubPackageResolutionTest { test_Double() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C extends Double {} +final class C extends Double {} ''', [ - error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 6), + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 41, 6), + error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 41, 6), ]); } @@ -43,6 +45,8 @@ class C extends Finalizable {} import 'dart:ffi'; class C extends Float {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 5), ]); } @@ -52,6 +56,8 @@ class C extends Float {} import 'dart:ffi'; class C extends Int16 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 5), ]); } @@ -61,6 +67,8 @@ class C extends Int16 {} import 'dart:ffi'; class C extends Int32 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 5), ]); } @@ -70,6 +78,8 @@ class C extends Int32 {} import 'dart:ffi'; class C extends Int64 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 5), ]); } @@ -79,6 +89,8 @@ class C extends Int64 {} import 'dart:ffi'; class C extends Int8 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 4), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 4), ]); } @@ -90,6 +102,8 @@ class C extends Pointer { external factory C(); } ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 7), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 7), ]); } @@ -97,7 +111,7 @@ class C extends Pointer { test_Struct() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } '''); @@ -108,6 +122,8 @@ class C extends Struct { import 'dart:ffi'; class C extends Uint16 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 6), ]); } @@ -117,6 +133,8 @@ class C extends Uint16 {} import 'dart:ffi'; class C extends Uint32 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 6), ]); } @@ -126,6 +144,8 @@ class C extends Uint32 {} import 'dart:ffi'; class C extends Uint64 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 6), ]); } @@ -135,6 +155,8 @@ class C extends Uint64 {} import 'dart:ffi'; class C extends Uint8 {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 5), ]); } @@ -142,7 +164,7 @@ class C extends Uint8 {} test_Union() async { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class C extends Union { +final class C extends Union { external Pointer notEmpty; } '''); @@ -153,6 +175,8 @@ class C extends Union { import 'dart:ffi'; class C extends Void {} ''', [ + error( + CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY, 35, 4), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS, 35, 4), ]); } @@ -165,6 +189,8 @@ class SubtypeOfFfiClassInImplementsTest extends PubPackageResolutionTest { import 'dart:ffi'; class C implements Double {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 6, messageContains: ["class 'C'", "implement 'Double'"]), ]); @@ -175,6 +201,8 @@ class C implements Double {} import 'dart:ffi' as ffi; class C implements ffi.Double {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 45, + 10), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 45, 10, messageContains: ["class 'C'", "implement 'ffi.Double'"]), ]); @@ -192,6 +220,8 @@ class C implements Finalizable {} import 'dart:ffi'; class C implements Float {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), ]); } @@ -201,6 +231,8 @@ class C implements Float {} import 'dart:ffi'; class C implements Int16 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), ]); } @@ -210,6 +242,8 @@ class C implements Int16 {} import 'dart:ffi'; class C implements Int32 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), ]); } @@ -219,6 +253,8 @@ class C implements Int32 {} import 'dart:ffi'; class C implements Int64 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), ]); } @@ -228,6 +264,8 @@ class C implements Int64 {} import 'dart:ffi'; class C implements Int8 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 4), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 4), ]); } @@ -237,6 +275,8 @@ class C implements Int8 {} import 'dart:ffi'; class C implements Pointer {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 7), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 7), ]); } @@ -244,9 +284,11 @@ class C implements Pointer {} test_Struct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C implements Struct {} +final class C implements Struct {} ''', [ - error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 6), + error(CompileTimeErrorCode.BASE_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 44, + 6), + error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 44, 6), ]); } @@ -255,6 +297,8 @@ class C implements Struct {} import 'dart:ffi'; class C implements Uint16 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 6), ]); } @@ -264,6 +308,8 @@ class C implements Uint16 {} import 'dart:ffi'; class C implements Uint32 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 6), ]); } @@ -273,6 +319,8 @@ class C implements Uint32 {} import 'dart:ffi'; class C implements Uint64 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 6), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 6), ]); } @@ -282,6 +330,8 @@ class C implements Uint64 {} import 'dart:ffi'; class C implements Uint8 {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 5), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), ]); } @@ -289,9 +339,11 @@ class C implements Uint8 {} test_Union() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C implements Union {} +final class C implements Union {} ''', [ - error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 5), + error(CompileTimeErrorCode.BASE_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 44, + 5), + error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 44, 5), ]); } @@ -300,6 +352,8 @@ class C implements Union {} import 'dart:ffi'; class C implements Void {} ''', [ + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 38, + 4), error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS, 38, 4), ]); } @@ -399,10 +453,10 @@ class C with Pointer {} test_Struct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C with Struct {} +final class C with Struct {} ''', [ - error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 6), - error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH, 32, 6), + error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 38, 6), + error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH, 38, 6), ]); } @@ -453,10 +507,10 @@ class C with Uint8 {} test_Union() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class C with Union {} +final class C with Union {} ''', [ - error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 32, 5), - error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH, 32, 5), + error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 38, 5), + error(FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH, 38, 5), ]); } diff --git a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart index f459798731d..b575a98bf80 100644 --- a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart +++ b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart @@ -21,24 +21,24 @@ class SubtypeOfStructClassInExtendsTest extends PubPackageResolutionTest { test_extends_struct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } -class C extends S {} +final class C extends S {} ''', [ - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS, 91, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS, 103, 1), ]); } test_extends_union() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Union { +final class S extends Union { external Pointer notEmpty; } -class C extends S {} +final class C extends S {} ''', [ - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS, 90, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS, 102, 1), ]); } } @@ -51,25 +51,25 @@ import 'dart:ffi'; @AbiSpecificIntegerMapping({ Abi.androidArm: Uint32(), }) -class AbiSpecificInteger1 extends AbiSpecificInteger { +final class AbiSpecificInteger1 extends AbiSpecificInteger { const AbiSpecificInteger1(); } -class AbiSpecificInteger4 implements AbiSpecificInteger1 { +final class AbiSpecificInteger4 implements AbiSpecificInteger1 { const AbiSpecificInteger4(); } ''', [ - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 204, 19), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 216, 19), ]); } test_implements_struct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Struct {} -class C implements S {} +final class S extends Struct {} +final class C implements S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 25, 1), - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 64, 1, + error(FfiCode.EMPTY_STRUCT, 31, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 76, 1, messageContains: ["class 'C'", "implement 'S'"]), ]); } @@ -77,25 +77,26 @@ class C implements S {} test_implements_struct_prefixed() async { newFile('$testPackageLibPath/lib1.dart', ''' import 'dart:ffi'; -class S extends Struct {} +final class S extends Struct {} '''); await assertErrorsInCode(r''' import 'lib1.dart' as lib1; class C implements lib1.S {} ''', [ - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 47, 6, - messageContains: ["class 'C'", "implement 'lib1.S'"]), + error(CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY, 47, + 6), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 47, 6), ]); } test_implements_union() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Union {} -class C implements S {} +final class S extends Union {} +final class C implements S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 25, 1), - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 63, 1), + error(FfiCode.EMPTY_STRUCT, 31, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 75, 1), ]); } } @@ -105,12 +106,12 @@ class SubtypeOfStructClassInWithTest extends PubPackageResolutionTest { test_with_struct() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Struct {} -class C with S {} +final class S extends Struct {} +final class C with S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 25, 1), - error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 58, 1), - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 58, 1, + error(FfiCode.EMPTY_STRUCT, 31, 1), + error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 70, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 70, 1, messageContains: ["class 'C'", "mix in 'S'"]), ]); } @@ -118,7 +119,7 @@ class C with S {} test_with_struct_prefixed() async { newFile('$testPackageLibPath/lib1.dart', ''' import 'dart:ffi'; -class S extends Struct {} +final class S extends Struct {} '''); await assertErrorsInCode(r''' import 'lib1.dart' as lib1; @@ -134,12 +135,12 @@ class C with lib1.S {} test_with_union() async { await assertErrorsInCode(r''' import 'dart:ffi'; -class S extends Union {} -class C with S {} +final class S extends Union {} +final class C with S {} ''', [ - error(FfiCode.EMPTY_STRUCT, 25, 1), - error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 57, 1), - error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 57, 1), + error(FfiCode.EMPTY_STRUCT, 31, 1), + error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 69, 1), + error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 69, 1), ]); } } diff --git a/pkg/analyzer/test/verify_diagnostics_test.dart b/pkg/analyzer/test/verify_diagnostics_test.dart index da380e45158..3be55075713 100644 --- a/pkg/analyzer/test/verify_diagnostics_test.dart +++ b/pkg/analyzer/test/verify_diagnostics_test.dart @@ -91,6 +91,9 @@ class DocumentationValidator { 'FfiCode.FIELD_INITIALIZER_IN_STRUCT', // This is not reported after 2.12, and the examples don't compile after 3.0. 'FfiCode.FIELD_IN_STRUCT_WITH_INITIALIZER', + // The examples has more than one error message in 3.0. + // Also: CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY. + 'FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS', // This no longer works in 3.0. 'HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE', diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md index 99ac1fcca92..41b2dc24f02 100644 --- a/pkg/analyzer/tool/diagnostics/diagnostics.md +++ b/pkg/analyzer/tool/diagnostics/diagnostics.md @@ -323,7 +323,7 @@ define a const constructor: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class [!C!] extends AbiSpecificInteger { +final class [!C!] extends AbiSpecificInteger { } {% endprettify %} @@ -334,7 +334,7 @@ a `const` constructor: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class [!C!] extends AbiSpecificInteger { +final class [!C!] extends AbiSpecificInteger { C(); } {% endprettify %} @@ -346,7 +346,7 @@ multiple constructors: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class [!C!] extends AbiSpecificInteger { +final class [!C!] extends AbiSpecificInteger { const C.zero(); const C.one(); } @@ -359,7 +359,7 @@ a field: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class [!C!] extends AbiSpecificInteger { +final class [!C!] extends AbiSpecificInteger { final int i; const C(this.i); @@ -373,7 +373,7 @@ type parameter: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class [!C!] extends AbiSpecificInteger { // type parameters +final class [!C!] extends AbiSpecificInteger { // type parameters const C(); } {% endprettify %} @@ -387,7 +387,7 @@ parameters and a single member that is a `const` constructor: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -413,7 +413,7 @@ import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) @[!AbiSpecificIntegerMapping!]({Abi.linuxX64 : Uint16()}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -427,7 +427,7 @@ appropriate: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8(), Abi.linuxX64 : Uint16()}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -451,7 +451,7 @@ The following code produces this diagnostic because there's no {% prettify dart tag=pre+code %} import 'dart:ffi'; -class [!C!] extends AbiSpecificInteger { +final class [!C!] extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -464,7 +464,7 @@ Add an `AbiSpecificIntegerMapping` annotation to the class: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -497,7 +497,7 @@ entry is `Array`, which isn't a valid integer type: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : [!Array(4)!]}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -510,7 +510,7 @@ Use one of the valid types as a value in the map: import 'dart:ffi'; @AbiSpecificIntegerMapping({Abi.macosX64 : Int8()}) -class C extends AbiSpecificInteger { +final class C extends AbiSpecificInteger { const C(); } {% endprettify %} @@ -951,7 +951,7 @@ annotation `@Double()`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { [!@Double()!] external Pointer p; } @@ -964,7 +964,7 @@ Remove the annotations from the field: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external Pointer p; } {% endprettify %} @@ -2426,7 +2426,7 @@ implements `Finalizable`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class [!S!] extends Struct implements Finalizable { +final class [!S!] extends Struct implements Finalizable { external Pointer notEmpty; } {% endprettify %} @@ -2438,7 +2438,7 @@ Try removing the implements clause from the class: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -3566,7 +3566,7 @@ instantiated using a generative constructor: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int a; } @@ -3585,7 +3585,7 @@ If you need to allocate the structure described by the class, then use the import 'dart:ffi'; import 'package:ffi/ffi.dart'; -class C extends Struct { +final class C extends Struct { @Int32() external int a; } @@ -5253,7 +5253,7 @@ extends `Struct`, doesn't declare any fields: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class [!C!] extends Struct {} +final class [!C!] extends Struct {} {% endprettify %} #### Common fixes @@ -5263,7 +5263,7 @@ If the class is intended to be a struct, then declare one or more fields: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int x; } @@ -5275,7 +5275,7 @@ make it a subclass of `Opaque`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Opaque {} +final class C extends Opaque {} {% endprettify %} If the class isn't intended to be a struct, then remove or change the @@ -6414,7 +6414,7 @@ annotations describing the native type of the field: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() [!@Int16()!] external int x; @@ -6427,7 +6427,7 @@ Remove all but one of the annotations: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int x; } @@ -6530,7 +6530,7 @@ annotations that specify the size of the native array: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(4) [!@Array(8)!] external Array a0; @@ -6544,7 +6544,7 @@ Remove all but one of the annotations: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } @@ -6746,7 +6746,7 @@ constructor with an initializer for the field `f`: // @dart = 2.9 import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() int f; @@ -6762,7 +6762,7 @@ Remove the field initializer: // @dart = 2.9 import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() int f; @@ -7011,7 +7011,7 @@ initializer: // @dart = 2.9 import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { Pointer [!p!] = nullptr; } {% endprettify %} @@ -7024,7 +7024,7 @@ Remove the initializer: // @dart = 2.9 import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { Pointer p; } {% endprettify %} @@ -7048,7 +7048,7 @@ marked as being `external`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int16() int [!a!]; } @@ -7061,7 +7061,7 @@ Add the required `external` modifier: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int16() external int a; } @@ -7474,7 +7474,7 @@ the type parameter `T`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class [!S!] extends Struct { +final class [!S!] extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -7486,7 +7486,7 @@ Remove the type parameters from the class: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -9543,7 +9543,7 @@ subclass of `Struct`: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external [!String!] s; @Int32() @@ -9559,7 +9559,7 @@ Use one of the allowed types for the field: import 'dart:ffi'; import 'package:ffi/ffi.dart'; -class C extends Struct { +final class C extends Struct { external Pointer s; @Int32() @@ -11801,7 +11801,7 @@ The following code produces this diagnostic because the annotation {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { [!@Double()!] external int x; } @@ -11814,7 +11814,7 @@ If the type of the field is correct, then change the annotation to match: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int x; } @@ -11825,7 +11825,7 @@ If the annotation is correct, then change the type of the field to match: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Double() external double x; } @@ -11854,7 +11854,7 @@ have an annotation indicating the underlying width of the integer value: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external [!int!] x; } {% endprettify %} @@ -11866,7 +11866,7 @@ Add an appropriate annotation to the field: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int64() external int x; } @@ -12069,7 +12069,7 @@ doesn't have a type annotation: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external var [!str!]; @Int32() @@ -12085,7 +12085,7 @@ Explicitly specify the type of the field: import 'dart:ffi'; import 'package:ffi/ffi.dart'; -class C extends Struct { +final class C extends Struct { external Pointer str; @Int32() @@ -12372,7 +12372,7 @@ have an `Array` annotation: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { external [!Array!] a0; } {% endprettify %} @@ -12384,7 +12384,7 @@ Ensure that there's exactly one `Array` annotation on the field: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } @@ -14479,7 +14479,7 @@ The following code produces this diagnostic because an array dimension of {% prettify dart tag=pre+code %} import 'dart:ffi'; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array([!-8!]) external Array a0; } @@ -14492,7 +14492,7 @@ Change the dimension to be a positive integer: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Array(8) external Array a0; } @@ -14520,7 +14520,7 @@ The following code produces this diagnostic because the type argument to {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array<[!Void!]> a0; } @@ -14533,7 +14533,7 @@ Change the type argument to one of the valid types: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8) external Array a0; } @@ -15691,7 +15691,7 @@ import 'dart:ffi'; @Packed(1) [!@Packed(1)!] -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -15704,7 +15704,7 @@ Remove all but one of the annotations: import 'dart:ffi'; @Packed(1) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -15729,7 +15729,7 @@ The following code produces this diagnostic because the argument to the import 'dart:ffi'; @Packed([!3!]) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -15742,7 +15742,7 @@ Change the alignment to be one of the allowed values: import 'dart:ffi'; @Packed(4) -class C extends Struct { +final class C extends Struct { external Pointer notEmpty; } {% endprettify %} @@ -18409,7 +18409,7 @@ type with three nested arrays, but only two dimensions are given in the {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { [!@Array(8, 8)!] external Array>> a0; } @@ -18423,7 +18423,7 @@ required number of dimensions: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8, 8, 4) external Array>> a0; } @@ -18434,7 +18434,7 @@ If the type of the field is wrong, then fix the type of the field: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Array(8, 8) external Array> a0; } @@ -18662,7 +18662,7 @@ The following code produces this diagnostic because the class `C` extends {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends [!Double!] {} +final class C extends [!Double!] {} {% endprettify %} #### Common fixes @@ -18673,7 +18673,7 @@ declaration of the class: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class C extends Struct { +final class C extends Struct { @Int32() external int i; } @@ -18683,7 +18683,7 @@ If the class shouldn't extend either `Struct` or `Union`, then remove any references to FFI classes: {% prettify dart tag=pre+code %} -class C {} +final class C {} {% endprettify %} ### subtype_of_sealed_class @@ -18764,11 +18764,11 @@ The following code produces this diagnostic because the class `C` extends {% prettify dart tag=pre+code %} import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer f; } -class C extends [!S!] { +final class C extends [!S!] { external Pointer g; } {% endprettify %} @@ -18782,11 +18782,11 @@ directly and copy the shared fields: {% prettify dart tag=pre+code %} import 'dart:ffi'; -class S extends Struct { +final class S extends Struct { external Pointer f; } -class C extends Struct { +final class C extends Struct { external Pointer f; external Pointer g; diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart index b1df269b443..f565a42d52e 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart @@ -4,9 +4,9 @@ class Struct {} -class StructA extends Struct {} +final class StructA extends Struct {} -class StructB extends Struct {} +final class StructB extends Struct {} class NonStruct {} diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.expect index 929b404e14c..45f3215cbf3 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.expect @@ -85,12 +85,12 @@ class Struct extends core::Object { : super core::Object::•() ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA : super self::Struct::•() ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB : super self::Struct::•() ; diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.transformed.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.transformed.expect index 94f82ee0b67..794c8c03cf9 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.strong.transformed.expect @@ -85,12 +85,12 @@ class Struct extends core::Object { : super core::Object::•() ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA : super self::Struct::•() ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB : super self::Struct::•() ; diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline.expect index 3e1bb003a0b..43e30fcee90 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline.expect @@ -1,8 +1,8 @@ class Struct {} -class StructA extends Struct {} +final class StructA extends Struct {} -class StructB extends Struct {} +final class StructB extends Struct {} class NonStruct {} diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline_modelled.expect index db899519ed5..6e759e59a57 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.textual_outline_modelled.expect @@ -2,10 +2,6 @@ class NonStruct {} class Struct {} -class StructA extends Struct {} - -class StructB extends Struct {} - errors() {} extension Extension on T { @@ -14,5 +10,9 @@ extension Extension on T { void set property(T value) {} } +final class StructA extends Struct {} + +final class StructB extends Struct {} + main() {} testNonStruct() {} diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.expect index 929b404e14c..45f3215cbf3 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.expect @@ -85,12 +85,12 @@ class Struct extends core::Object { : super core::Object::•() ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA : super self::Struct::•() ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB : super self::Struct::•() ; diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.modular.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.modular.expect index 929b404e14c..45f3215cbf3 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.modular.expect @@ -85,12 +85,12 @@ class Struct extends core::Object { : super core::Object::•() ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA : super self::Struct::•() ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB : super self::Struct::•() ; diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.outline.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.outline.expect index ece84faa34f..535e3b3ebd7 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.outline.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.outline.expect @@ -6,11 +6,11 @@ class Struct extends core::Object { synthetic constructor •() → self::Struct ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB ; } diff --git a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.transformed.expect b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.transformed.expect index d60080bdb3c..d116c89043c 100644 --- a/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/extensions/on_type_variable_inference2.dart.weak.transformed.expect @@ -85,12 +85,12 @@ class Struct extends core::Object { : super core::Object::•() ; } -class StructA extends self::Struct { +final class StructA extends self::Struct { synthetic constructor •() → self::StructA : super self::Struct::•() ; } -class StructB extends self::Struct { +final class StructB extends self::Struct { synthetic constructor •() → self::StructB : super self::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/crash_05.yaml b/pkg/front_end/testcases/incremental/crash_05.yaml index e0250fa50e9..7db9f5d5679 100644 --- a/pkg/front_end/testcases/incremental/crash_05.yaml +++ b/pkg/front_end/testcases/incremental/crash_05.yaml @@ -11,12 +11,12 @@ worlds: main.dart: | import 'dart:ffi'; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external Y xx; } lib.dart: | import 'dart:ffi'; - class Y extends Struct { + final class Y extends Struct { @Uint32() external int yy; } diff --git a/pkg/front_end/testcases/incremental/crash_05.yaml.world.1.expect b/pkg/front_end/testcases/incremental/crash_05.yaml.world.1.expect index a0e99d7e844..a42fec4e496 100644 --- a/pkg/front_end/testcases/incremental/crash_05.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/crash_05.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C6 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -28,7 +28,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C17 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/crash_05.yaml.world.2.expect b/pkg/front_end/testcases/incremental/crash_05.yaml.world.2.expect index a0e99d7e844..a42fec4e496 100644 --- a/pkg/front_end/testcases/incremental/crash_05.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/crash_05.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C6 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -28,7 +28,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C17 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/crash_06.yaml b/pkg/front_end/testcases/incremental/crash_06.yaml index fb7f5602fdc..1686df36816 100644 --- a/pkg/front_end/testcases/incremental/crash_06.yaml +++ b/pkg/front_end/testcases/incremental/crash_06.yaml @@ -11,10 +11,10 @@ worlds: sources: structs.dart: | import 'dart:ffi'; - class A extends Struct { + final class A extends Struct { external Y yy; } - class Y extends Struct { + final class Y extends Struct { external Z zz; } expectedLibraryCount: 1 diff --git a/pkg/front_end/testcases/incremental/crash_06.yaml.world.1.expect b/pkg/front_end/testcases/incremental/crash_06.yaml.world.1.expect index 3979c0b226f..6b565d751d6 100644 --- a/pkg/front_end/testcases/incremental/crash_06.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/crash_06.yaml.world.1.expect @@ -22,7 +22,7 @@ library from "org-dartlang-test:///structs.dart" as str { import "dart:ffi"; @#C6 - class A extends dart.ffi::Struct { + final class A extends dart.ffi::Struct { synthetic constructor •() → str::A : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///structs.dart" as str { static get #sizeOf() → dart.core::int* return #C8.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*}; } - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → str::Y : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/crash_06.yaml.world.2.expect b/pkg/front_end/testcases/incremental/crash_06.yaml.world.2.expect index 3979c0b226f..6b565d751d6 100644 --- a/pkg/front_end/testcases/incremental/crash_06.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/crash_06.yaml.world.2.expect @@ -22,7 +22,7 @@ library from "org-dartlang-test:///structs.dart" as str { import "dart:ffi"; @#C6 - class A extends dart.ffi::Struct { + final class A extends dart.ffi::Struct { synthetic constructor •() → str::A : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///structs.dart" as str { static get #sizeOf() → dart.core::int* return #C8.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*}; } - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → str::Y : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/ffi_01.yaml b/pkg/front_end/testcases/incremental/ffi_01.yaml index 8c8cc59e84b..81ecac15230 100644 --- a/pkg/front_end/testcases/incremental/ffi_01.yaml +++ b/pkg/front_end/testcases/incremental/ffi_01.yaml @@ -20,7 +20,7 @@ worlds: lib.dart: | import 'dart:ffi'; - class Coordinate extends Struct { + final class Coordinate extends Struct { @Double() external double x; diff --git a/pkg/front_end/testcases/incremental/ffi_01.yaml.world.1.expect b/pkg/front_end/testcases/incremental/ffi_01.yaml.world.1.expect index 6991115c026..493098144b3 100644 --- a/pkg/front_end/testcases/incremental/ffi_01.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/ffi_01.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/ffi_01.yaml.world.2.expect b/pkg/front_end/testcases/incremental/ffi_01.yaml.world.2.expect index 7567b3f59d1..5c4ed2490f1 100644 --- a/pkg/front_end/testcases/incremental/ffi_01.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/ffi_01.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/ffi_02.yaml b/pkg/front_end/testcases/incremental/ffi_02.yaml index 6ee17d2c9bc..c3473da30f9 100644 --- a/pkg/front_end/testcases/incremental/ffi_02.yaml +++ b/pkg/front_end/testcases/incremental/ffi_02.yaml @@ -23,7 +23,7 @@ worlds: lib.dart: | import 'dart:ffi'; - class Coordinate extends Struct { + final class Coordinate extends Struct { @Double() external double x; diff --git a/pkg/front_end/testcases/incremental/ffi_02.yaml.world.1.expect b/pkg/front_end/testcases/incremental/ffi_02.yaml.world.1.expect index 876bb0190b1..4565d5b3342 100644 --- a/pkg/front_end/testcases/incremental/ffi_02.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/ffi_02.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/issue_46666.yaml b/pkg/front_end/testcases/incremental/issue_46666.yaml index 3eafeb789d8..30138c4cf41 100644 --- a/pkg/front_end/testcases/incremental/issue_46666.yaml +++ b/pkg/front_end/testcases/incremental/issue_46666.yaml @@ -11,14 +11,14 @@ worlds: a.dart: | import 'dart:ffi'; - class StructA extends Struct { + final class StructA extends Struct { external Pointer a1; external Pointer a2; external Pointer a3; external NestedStruct blah; } - class NestedStruct extends Struct { + final class NestedStruct extends Struct { external Pointer n1; external Pointer n2; external Pointer n3; @@ -30,7 +30,7 @@ worlds: import 'a.dart'; - class StructB extends Struct { + final class StructB extends Struct { external StructA b1; } diff --git a/pkg/front_end/testcases/incremental/issue_46666.yaml.world.1.expect b/pkg/front_end/testcases/incremental/issue_46666.yaml.world.1.expect index 9491f21e810..df0e2556612 100644 --- a/pkg/front_end/testcases/incremental/issue_46666.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/issue_46666.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///a.dart" as a { import "dart:ffi"; @#C7 - class StructA extends dart.ffi::Struct { + final class StructA extends dart.ffi::Struct { synthetic constructor •() → a::StructA : super dart.ffi::Struct::•() ; @@ -35,7 +35,7 @@ library from "org-dartlang-test:///a.dart" as a { return #C21.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*}; } @#C24 - class NestedStruct extends dart.ffi::Struct { + final class NestedStruct extends dart.ffi::Struct { synthetic constructor •() → a::NestedStruct : super dart.ffi::Struct::•() ; @@ -67,7 +67,7 @@ library from "org-dartlang-test:///b.dart" as b { import "org-dartlang-test:///a.dart"; @#C28 - class StructB extends dart.ffi::Struct { + final class StructB extends dart.ffi::Struct { synthetic constructor •() → b::StructB : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/issue_46666.yaml.world.2.expect b/pkg/front_end/testcases/incremental/issue_46666.yaml.world.2.expect index 9491f21e810..df0e2556612 100644 --- a/pkg/front_end/testcases/incremental/issue_46666.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/issue_46666.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///a.dart" as a { import "dart:ffi"; @#C7 - class StructA extends dart.ffi::Struct { + final class StructA extends dart.ffi::Struct { synthetic constructor •() → a::StructA : super dart.ffi::Struct::•() ; @@ -35,7 +35,7 @@ library from "org-dartlang-test:///a.dart" as a { return #C21.{dart.core::List::[]}(dart.ffi::_abi()){(dart.core::int) → dart.core::int*}; } @#C24 - class NestedStruct extends dart.ffi::Struct { + final class NestedStruct extends dart.ffi::Struct { synthetic constructor •() → a::NestedStruct : super dart.ffi::Struct::•() ; @@ -67,7 +67,7 @@ library from "org-dartlang-test:///b.dart" as b { import "org-dartlang-test:///a.dart"; @#C28 - class StructB extends dart.ffi::Struct { + final class StructB extends dart.ffi::Struct { synthetic constructor •() → b::StructB : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml index aed97e7f81a..0a32c59e328 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml +++ b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml @@ -21,7 +21,7 @@ worlds: } lib.dart: | import 'dart:ffi'; - class Coordinate extends Struct { + final class Coordinate extends Struct { @Double() external double x; @@ -61,7 +61,7 @@ worlds: sources: lib.dart: | import 'dart:ffi'; - class Coordinate extends Struct { + final class Coordinate extends Struct { @Double() external double x; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.1.expect index 6991115c026..493098144b3 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.2.expect index 027e835d16d..2d2e604f53f 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.3.expect b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.3.expect index 9bd089ec28c..5c41819ef49 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.3.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml.world.3.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Coordinate extends dart.ffi::Struct { + final class Coordinate extends dart.ffi::Struct { constructor #fromTypedDataBase(synthesized dart.core::Object #typedDataBase) → lib::Coordinate : super dart.ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml index 031d56fed33..5bdf4ae711d 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml +++ b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml @@ -12,7 +12,7 @@ worlds: main.dart: | import "dart:ffi"; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external Y x1; external Y x2; @Uint8() @@ -20,7 +20,7 @@ worlds: } lib.dart: | import 'dart:ffi'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint8() @@ -38,7 +38,7 @@ worlds: sources: lib.dart: | import 'dart:ffi'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint64() diff --git a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.1.expect index e54e24dec4c..cacd8e979b4 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.2.expect index 57c42a453fd..e0898a88c6c 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml index 9b2023d1bb1..5da320f1331 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml +++ b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml @@ -13,7 +13,7 @@ worlds: main.dart: | import "dart:ffi"; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external Y x1; external Y x2; @Uint8() @@ -21,7 +21,7 @@ worlds: } lib.dart: | import 'dart:ffi'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint8() @@ -39,7 +39,7 @@ worlds: main.dart: | import "dart:ffi"; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external Y x1; external Y x2; @Uint8() @@ -47,7 +47,7 @@ worlds: } lib.dart: | import 'dart:ffi'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint64() diff --git a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.1.expect index e54e24dec4c..cacd8e979b4 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.2.expect index 57c42a453fd..e0898a88c6c 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -40,7 +40,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml index 0ebba26b9f0..b86e062fc66 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml +++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml @@ -12,7 +12,7 @@ worlds: main.dart: | import "dart:ffi"; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external Y x1; external Y x2; @Uint8() @@ -20,7 +20,7 @@ worlds: } lib.dart: | import 'lib2.dart'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint8() @@ -42,7 +42,7 @@ worlds: sources: lib.dart: | import 'lib2.dart'; - class Y extends Struct { + final class Y extends Struct { @Uint8() external int y1; @Uint64() diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect index cd07aa9392a..ad40d2e640c 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "org-dartlang-test:///lib2.dart"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -232,7 +232,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect index 49b4343cc0b..4580f448da6 100644 --- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "org-dartlang-test:///lib2.dart"; @#C7 - class Y extends dart.ffi::Struct { + final class Y extends dart.ffi::Struct { synthetic constructor •() → lib::Y : super dart.ffi::Struct::•() ; @@ -232,7 +232,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C25 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/regress_46004.yaml b/pkg/front_end/testcases/incremental/regress_46004.yaml index 6f6817d2163..7933fcc325a 100644 --- a/pkg/front_end/testcases/incremental/regress_46004.yaml +++ b/pkg/front_end/testcases/incremental/regress_46004.yaml @@ -9,13 +9,13 @@ worlds: main.dart: | import 'dart:ffi'; import 'lib.dart'; - class X extends Struct { + final class X extends Struct { external COMObject xx; } lib.dart: | import 'dart:ffi'; - class COMObject extends Struct { + final class COMObject extends Struct { external Pointer lpVtbl; // This should not be interpreted as a native field. diff --git a/pkg/front_end/testcases/incremental/regress_46004.yaml.world.1.expect b/pkg/front_end/testcases/incremental/regress_46004.yaml.world.1.expect index 95a483a81ad..1065be5d40c 100644 --- a/pkg/front_end/testcases/incremental/regress_46004.yaml.world.1.expect +++ b/pkg/front_end/testcases/incremental/regress_46004.yaml.world.1.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C6 - class COMObject extends dart.ffi::Struct { + final class COMObject extends dart.ffi::Struct { synthetic constructor •() → lib::COMObject : super dart.ffi::Struct::•() ; @@ -28,7 +28,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C17 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/incremental/regress_46004.yaml.world.2.expect b/pkg/front_end/testcases/incremental/regress_46004.yaml.world.2.expect index 95a483a81ad..1065be5d40c 100644 --- a/pkg/front_end/testcases/incremental/regress_46004.yaml.world.2.expect +++ b/pkg/front_end/testcases/incremental/regress_46004.yaml.world.2.expect @@ -4,7 +4,7 @@ library from "org-dartlang-test:///lib.dart" as lib { import "dart:ffi"; @#C6 - class COMObject extends dart.ffi::Struct { + final class COMObject extends dart.ffi::Struct { synthetic constructor •() → lib::COMObject : super dart.ffi::Struct::•() ; @@ -28,7 +28,7 @@ library from "org-dartlang-test:///main.dart" as main { import "org-dartlang-test:///lib.dart"; @#C17 - class X extends dart.ffi::Struct { + final class X extends dart.ffi::Struct { synthetic constructor •() → main::X : super dart.ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart b/pkg/front_end/testcases/nnbd/ffi_sample.dart index c45b492185f..ae452094a57 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart @@ -9,7 +9,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; /// Sample struct for dart:ffi library. -class Coordinate extends Struct { +final class Coordinate extends Struct { @Double() external double x; diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect index 4e873a46198..0613a41f1bd 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.expect @@ -6,7 +6,7 @@ import "dart:core" as core; import "dart:ffi"; import "package:ffi/ffi.dart"; -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { @#C1 external get x() → core::double; @#C1 diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect index 883d86554d2..817d64c06eb 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect @@ -7,7 +7,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C7 -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { constructor #fromTypedDataBase(synthesized core::Object #typedDataBase) → self::Coordinate : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline.expect index 326d793fd1a..8f1d9947d77 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline.expect @@ -1,7 +1,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; -class Coordinate extends Struct { +final class Coordinate extends Struct { @Double() external double x; @Double() diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline_modelled.expect index 88e9317f72a..7dca6005a7e 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.textual_outline_modelled.expect @@ -1,7 +1,7 @@ import "package:ffi/ffi.dart"; import 'dart:ffi'; -class Coordinate extends Struct { +final class Coordinate extends Struct { external Pointer next; @Double() external double x; diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect index 4e873a46198..0613a41f1bd 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.expect @@ -6,7 +6,7 @@ import "dart:core" as core; import "dart:ffi"; import "package:ffi/ffi.dart"; -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { @#C1 external get x() → core::double; @#C1 diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect index 4e873a46198..0613a41f1bd 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.modular.expect @@ -6,7 +6,7 @@ import "dart:core" as core; import "dart:ffi"; import "package:ffi/ffi.dart"; -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { @#C1 external get x() → core::double; @#C1 diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.outline.expect index ad4664a1c1a..f46aa7d98fd 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.outline.expect @@ -6,7 +6,7 @@ import "dart:core" as core; import "dart:ffi"; import "package:ffi/ffi.dart"; -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { @ffi::Double::•() external get x() → core::double; @ffi::Double::•() diff --git a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect index 883d86554d2..817d64c06eb 100644 --- a/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_sample.dart.weak.transformed.expect @@ -7,7 +7,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C7 -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { constructor #fromTypedDataBase(synthesized core::Object #typedDataBase) → self::Coordinate : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart index 36a022d7c5f..5be0188a3fa 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; -class StructInlineArray extends Struct { +final class StructInlineArray extends Struct { @Array(8) external Array a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect index d7c9920f7d0..eb76b68a927 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect index 342ff3e2e2f..0ff4b8a0f33 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.strong.transformed.expect @@ -9,7 +9,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C8 -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline.expect index 571304a1df0..d490c2e793e 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline.expect @@ -1,7 +1,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; -class StructInlineArray extends Struct { +final class StructInlineArray extends Struct { @Array(8) external Array a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline_modelled.expect index bc412cca989..cfd67288d50 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.textual_outline_modelled.expect @@ -1,7 +1,7 @@ import "package:ffi/ffi.dart"; import 'dart:ffi'; -class StructInlineArray extends Struct { +final class StructInlineArray extends Struct { @Array(8) external Array a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect index 89b12ef3a5c..666c954d1d8 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect index 89b12ef3a5c..666c954d1d8 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.modular.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.outline.expect index 209ea1d91f2..27ba559ef3b 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.outline.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray ; @ffi::_ArraySize::•(8) diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect index fe45ca31a20..61724fe11ce 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array.dart.weak.transformed.expect @@ -9,7 +9,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C8 -class StructInlineArray extends ffi::Struct { +final class StructInlineArray extends ffi::Struct { synthetic constructor •() → self::StructInlineArray : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart index 08618c82ad9..1f451a347db 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends Struct { +final class StructInlineArrayMultiDimensional extends Struct { @Array(2, 2, 2) external Array>> a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect index fdfed0fa829..38e340658c2 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect index 234416a01bc..3bd25c78bc1 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.strong.transformed.expect @@ -9,7 +9,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C8 -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline.expect index 677a6db3b9d..23b9ac3ce62 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline.expect @@ -1,7 +1,7 @@ import 'dart:ffi'; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends Struct { +final class StructInlineArrayMultiDimensional extends Struct { @Array(2, 2, 2) external Array>> a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline_modelled.expect index b7c36aa7cb5..9c1559393b3 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.textual_outline_modelled.expect @@ -1,7 +1,7 @@ import "package:ffi/ffi.dart"; import 'dart:ffi'; -class StructInlineArrayMultiDimensional extends Struct { +final class StructInlineArrayMultiDimensional extends Struct { @Array(2, 2, 2) external Array>> a0; } diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect index 399c88ce1de..95f7c0eb729 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect index 399c88ce1de..95f7c0eb729 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.modular.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional : super ffi::Struct::•() ; diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.outline.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.outline.expect index 4cd58160516..2a85a9ad280 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.outline.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.outline.expect @@ -5,7 +5,7 @@ import "dart:ffi" as ffi; import "dart:ffi"; import "package:ffi/ffi.dart"; -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional ; @ffi::_ArraySize::•(2, 2, 2) diff --git a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect index 9df512d9206..ea0ec399710 100644 --- a/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart.weak.transformed.expect @@ -9,7 +9,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; @#C8 -class StructInlineArrayMultiDimensional extends ffi::Struct { +final class StructInlineArrayMultiDimensional extends ffi::Struct { synthetic constructor •() → self::StructInlineArrayMultiDimensional : super ffi::Struct::•() ; diff --git a/pkg/vm/lib/transformations/ffi/definitions.dart b/pkg/vm/lib/transformations/ffi/definitions.dart index b2ca373ce6f..9a196c96b0e 100644 --- a/pkg/vm/lib/transformations/ffi/definitions.dart +++ b/pkg/vm/lib/transformations/ffi/definitions.dart @@ -38,7 +38,7 @@ import 'native_type_cfe.dart'; /// Checks and elaborates the dart:ffi compounds and their fields. /// /// Input: -/// class Coord extends Struct { +/// final class Coord extends Struct { /// @Double() /// double x; /// @@ -49,7 +49,7 @@ import 'native_type_cfe.dart'; /// } /// /// Output: -/// class Coord extends Struct { +/// final class Coord extends Struct { /// Coord.#fromTypedDataBase(Pointer coord) : super._(coord); /// /// set x(double v) => ...; diff --git a/pkg/vm/test/transformations/ffi_test.dart b/pkg/vm/test/transformations/ffi_test.dart index 8bd756e37de..9d5028b8a04 100644 --- a/pkg/vm/test/transformations/ffi_test.dart +++ b/pkg/vm/test/transformations/ffi_test.dart @@ -30,7 +30,7 @@ runTestCaseJit(Uri source) async { final target = VmTarget(TargetFlags()); Component component = await compileTestCaseToKernelProgram(source, - target: target, experimentalFlags: ['generic-metadata']); + target: target, experimentalFlags: ['class-modifiers']); final coreTypes = CoreTypes(component); @@ -53,7 +53,7 @@ runTestCaseAot(Uri source) async { final target = VmTarget(TargetFlags(supportMirrors: false)); Component component = await compileTestCaseToKernelProgram(source, - target: target, experimentalFlags: ['generic-metadata']); + target: target, experimentalFlags: ['class-modifiers']); const bool useGlobalTypeFlowAnalysis = true; const bool enableAsserts = false; @@ -84,7 +84,7 @@ void main(List args) { } group('ffi-transformations', () { - final testCasesDir = Directory(pkgVmDir + '/testcases/transformations/ffi'); + final testCasesDir = Directory(pkgVmDir + 'testcases/transformations/ffi'); for (var entry in testCasesDir .listSync(recursive: true, followLinks: false) diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart index 40544beb974..d9549479c7c 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart @@ -27,7 +27,7 @@ import 'dart:ffi'; Abi.windowsIA32: Uint16(), Abi.windowsX64: Uint16(), }) -class WChar extends AbiSpecificInteger { +final class WChar extends AbiSpecificInteger { const WChar(); } @@ -60,7 +60,7 @@ void testStoreLoadIndexed() { noAlloc.free(p); } -class WCharStruct extends Struct { +final class WCharStruct extends Struct { @WChar() external int a0; @@ -77,7 +77,7 @@ void testStruct() { noAlloc.free(p); } -class WCharArrayStruct extends Struct { +final class WCharArrayStruct extends Struct { @Array(100) external Array a0; } diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.aot.expect b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.aot.expect index 18d8f41d6c5..5d4ced5e7f1 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.aot.expect +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.aot.expect @@ -8,13 +8,13 @@ import "dart:_internal" as _in; import "dart:ffi"; @#C7 -abstract class WChar extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { +abstract final class WChar extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { [@vm.unboxing-info.metadata=()->i] @#C10 static get #sizeOf() → core::int* return #C13.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}; } @#C18 -class WCharStruct extends ffi::Struct { +final class WCharStruct extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.ffi::Pointer] synthesized core::Object #typedDataBase) → self::WCharStruct : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; @@ -27,7 +27,7 @@ class WCharStruct extends ffi::Struct { return #C22.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}; } @#C27 -class WCharArrayStruct extends ffi::Struct { +final class WCharArrayStruct extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.ffi::Pointer] synthesized core::Object #typedDataBase) → self::WCharArrayStruct : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.expect b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.expect index 864b49ccc8f..85eb129de3e 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.expect +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int.dart.expect @@ -9,7 +9,7 @@ import "dart:ffi"; @#C56 @#C63 -class WChar extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { +final class WChar extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { const constructor •() → self::WChar : super ffi::AbiSpecificInteger::•() ; @@ -18,7 +18,7 @@ class WChar extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { return #C67.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}; } @#C72 -class WCharStruct extends ffi::Struct { +final class WCharStruct extends ffi::Struct { synthetic constructor •() → self::WCharStruct : super ffi::Struct::•() ; @@ -42,7 +42,7 @@ class WCharStruct extends ffi::Struct { return #C76.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}; } @#C81 -class WCharArrayStruct extends ffi::Struct { +final class WCharArrayStruct extends ffi::Struct { synthetic constructor •() → self::WCharArrayStruct : super ffi::Struct::•() ; diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart index b9759e0e52e..1068124d61b 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart @@ -10,7 +10,7 @@ import 'dart:ffi'; Abi.linuxIA32: Uint32(), Abi.linuxX64: Uint32(), }) -class Incomplete extends AbiSpecificInteger { +final class Incomplete extends AbiSpecificInteger { const Incomplete(); } @@ -43,7 +43,7 @@ void testStoreLoadIndexed() { noAlloc.free(p); } -class IncompleteStruct extends Struct { +final class IncompleteStruct extends Struct { @Incomplete() external int a0; @@ -60,7 +60,7 @@ void testStruct() { noAlloc.free(p); } -class IncompleteArrayStruct extends Struct { +final class IncompleteArrayStruct extends Struct { @Array(100) external Array a0; } diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.aot.expect b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.aot.expect index 05578dabfc9..1b424d67eab 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.aot.expect +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.aot.expect @@ -8,13 +8,13 @@ import "dart:_internal" as _in; import "dart:ffi"; @#C6 -abstract class Incomplete extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { +abstract final class Incomplete extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { [@vm.unboxing-info.metadata=()->i] @#C8 static get #sizeOf() → core::int* return [@vm.inferred-type.metadata=dart.core::_Smi (value: 4)] ffi::_checkAbiSpecificIntegerMapping(#C10.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}); } @#C15 -class IncompleteStruct extends ffi::Struct { +final class IncompleteStruct extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.ffi::Pointer] synthesized core::Object #typedDataBase) → self::IncompleteStruct : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; @@ -27,7 +27,7 @@ class IncompleteStruct extends ffi::Struct { return [@vm.inferred-type.metadata=dart.core::_Smi (value: 8)] ffi::_checkAbiSpecificIntegerMapping(#C19.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}); } @#C24 -class IncompleteArrayStruct extends ffi::Struct { +final class IncompleteArrayStruct extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.ffi::Pointer] synthesized core::Object #typedDataBase) → self::IncompleteArrayStruct : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.expect b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.expect index 88de097b510..04e6c534ccf 100644 --- a/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.expect +++ b/pkg/vm/testcases/transformations/ffi/abi_specific_int_incomplete.dart.expect @@ -9,7 +9,7 @@ import "dart:ffi"; @#C21 @#C27 -class Incomplete extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { +final class Incomplete extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { const constructor •() → self::Incomplete : super ffi::AbiSpecificInteger::•() ; @@ -18,7 +18,7 @@ class Incomplete extends ffi::AbiSpecificInteger /*hasConstConstructor*/ { return ffi::_checkAbiSpecificIntegerMapping(#C31.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}); } @#C36 -class IncompleteStruct extends ffi::Struct { +final class IncompleteStruct extends ffi::Struct { synthetic constructor •() → self::IncompleteStruct : super ffi::Struct::•() ; @@ -42,7 +42,7 @@ class IncompleteStruct extends ffi::Struct { return ffi::_checkAbiSpecificIntegerMapping(#C40.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}); } @#C45 -class IncompleteArrayStruct extends ffi::Struct { +final class IncompleteArrayStruct extends ffi::Struct { synthetic constructor •() → self::IncompleteArrayStruct : super ffi::Struct::•() ; diff --git a/pkg/vm/testcases/transformations/ffi/compound_copies.dart b/pkg/vm/testcases/transformations/ffi/compound_copies.dart index 534f880319b..10a6f0eb3f7 100644 --- a/pkg/vm/testcases/transformations/ffi/compound_copies.dart +++ b/pkg/vm/testcases/transformations/ffi/compound_copies.dart @@ -1,6 +1,6 @@ import 'dart:ffi'; -class Coordinate extends Struct { +final class Coordinate extends Struct { @Int64() external int x; @@ -12,7 +12,7 @@ class Coordinate extends Struct { } } -class SomeUnion extends Union { +final class SomeUnion extends Union { external Coordinate coordinate; @Int64() external int id; diff --git a/pkg/vm/testcases/transformations/ffi/compound_copies.dart.expect b/pkg/vm/testcases/transformations/ffi/compound_copies.dart.expect index 9a175f1d15d..23f5e4b1d43 100644 --- a/pkg/vm/testcases/transformations/ffi/compound_copies.dart.expect +++ b/pkg/vm/testcases/transformations/ffi/compound_copies.dart.expect @@ -8,7 +8,7 @@ import "dart:_internal" as _in; import "dart:ffi"; @#C6 -class Coordinate extends ffi::Struct { +final class Coordinate extends ffi::Struct { synthetic constructor •() → self::Coordinate : super ffi::Struct::•() ; @@ -35,7 +35,7 @@ class Coordinate extends ffi::Struct { return #C15.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}; } @#C19 -class SomeUnion extends ffi::Union { +final class SomeUnion extends ffi::Union { synthetic constructor •() → self::SomeUnion : super ffi::Union::•() ; diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart b/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart index abcf80c95cd..163a5c17bc0 100644 --- a/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart +++ b/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart @@ -5,65 +5,65 @@ import 'dart:ffi'; /// Retained because of being by-value return type in FFI call. -class Struct1 extends Struct { +final class Struct1 extends Struct { external Pointer notEmpty; } /// Retained because of being by-value return type in FFI call. -class Struct2 extends Struct { +final class Struct2 extends Struct { external Pointer notEmpty; } /// Retained because of being by-value argument type in FFI callback. -class Struct3 extends Struct { +final class Struct3 extends Struct { external Pointer notEmpty; } /// Class not retained, not referenced at all. -class Struct4 extends Struct { +final class Struct4 extends Struct { external Pointer notEmpty; } /// Constructor not retained, only referenced as argument type in FFI /// call but never instantiated in Dart code. -class Struct5 extends Struct { +final class Struct5 extends Struct { external Pointer notEmpty; } /// Constructor not retained, only referenced as argument type in FFI /// call but never instantiated in Dart code. -class Struct6 extends Struct { +final class Struct6 extends Struct { external Pointer notEmpty; } /// Constructor not retained, only referenced as return value type in FFI /// callback but never instantiated in Dart code. -class Struct7 extends Struct { +final class Struct7 extends Struct { external Pointer notEmpty; } /// Not retained because of FFI call not being reachable. -class Struct8 extends Struct { +final class Struct8 extends Struct { external Pointer notEmpty; } /// Not retained because of FFI call not being reachable. -class Struct9 extends Struct { +final class Struct9 extends Struct { external Pointer notEmpty; } /// Not retained because of FFI callback not being reachable. -class Struct10 extends Struct { +final class Struct10 extends Struct { external Pointer notEmpty; } /// Retained by CFE rewrite of load from pointer. -class Struct11 extends Struct { +final class Struct11 extends Struct { external Struct12 nested; } /// Retained by rewrite of load from surrounding struct. -class Struct12 extends Struct { +final class Struct12 extends Struct { external Pointer notEmpty; } diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart.expect index 10ab303f860..7abb48cef8b 100644 --- a/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart.expect +++ b/pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart.expect @@ -8,34 +8,34 @@ import "dart:_internal" as _in; import "dart:ffi"; @#C6 -class Struct1 extends ffi::Struct { +final class Struct1 extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.typed_data::_Uint8List] synthesized core::Object #typedDataBase) → self::Struct1 : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; } @#C6 -class Struct2 extends ffi::Struct { +final class Struct2 extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.typed_data::_Uint8List] synthesized core::Object #typedDataBase) → self::Struct2 : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; } @#C6 -class Struct3 extends ffi::Struct { +final class Struct3 extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.typed_data::_Uint8List] synthesized core::Object #typedDataBase) → self::Struct3 : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; } @#C6 -abstract class Struct5 extends ffi::Struct { +abstract final class Struct5 extends ffi::Struct { } @#C6 -abstract class Struct6 extends ffi::Struct { +abstract final class Struct6 extends ffi::Struct { } @#C6 -abstract class Struct7 extends ffi::Struct { +abstract final class Struct7 extends ffi::Struct { } @#C10 -class Struct11 extends ffi::Struct { +final class Struct11 extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=dart.ffi::Pointer] synthesized core::Object #typedDataBase) → self::Struct11 : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; @@ -46,7 +46,7 @@ class Struct11 extends ffi::Struct { } =>#typedDataBase is ffi::Pointer ?{core::Object} [@vm.inferred-type.metadata=dart.ffi::Pointer] ffi::_fromAddress([@vm.direct-call.metadata=dart.core::_IntegerImplementation.+] [@vm.inferred-type.metadata=int (skip check)] [@vm.direct-call.metadata=dart.ffi::Pointer.address] [@vm.inferred-type.metadata=int] #typedDataBase.{ffi::Pointer::address}{core::int}.{core::num::+}(#offset){(core::num) → core::num}) : let synthesized typ::TypedData #typedData = _in::unsafeCast(#typedDataBase) in [@vm.direct-call.metadata=dart.typed_data::_ByteBuffer.asUint8List] [@vm.inferred-type.metadata=dart.typed_data::_Uint8ArrayView (skip check)] [@vm.inferred-type.metadata=dart.typed_data::_ByteBuffer] #typedData.{typ::TypedData::buffer}{typ::ByteBuffer}.{typ::ByteBuffer::asUint8List}([@vm.direct-call.metadata=dart.core::_IntegerImplementation.+] [@vm.inferred-type.metadata=int (skip check)] [@vm.inferred-type.metadata=dart.core::_Smi] #typedData.{typ::TypedData::offsetInBytes}{core::int}.{core::num::+}(#offset){(core::num) → core::num}, #C15.{core::List::[]}(ffi::_abi()){(core::int) → core::int*}){([core::int, core::int?]) → typ::Uint8List}); } @#C6 -class Struct12 extends ffi::Struct { +final class Struct12 extends ffi::Struct { constructor #fromTypedDataBase([@vm.inferred-type.metadata=!] synthesized core::Object #typedDataBase) → self::Struct12 : super ffi::Struct::_fromTypedDataBase(#typedDataBase) ; diff --git a/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart b/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart index 14b92ff05ee..51684565c0b 100644 --- a/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart +++ b/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart @@ -21,7 +21,7 @@ final bool usesDwarfStackTraces = Platform.executableArguments final bool hasSymbolicStackTraces = !usesDwarfStackTraces; final sdkRoot = Platform.script.resolve('../../../../../'); -class Isolate extends Opaque {} +final class Isolate extends Opaque {} abstract class FfiBindings { static final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions"); diff --git a/runtime/tests/vm/dart/isolates/thread_pool_test.dart b/runtime/tests/vm/dart/isolates/thread_pool_test.dart index d12e2720fcc..4b864fd0c68 100644 --- a/runtime/tests/vm/dart/isolates/thread_pool_test.dart +++ b/runtime/tests/vm/dart/isolates/thread_pool_test.dart @@ -16,7 +16,7 @@ import '../../../../../tests/ffi/dylib_utils.dart'; // This should be larger than max-new-space-size/tlab-size. const int threadCount = 200; -class Isolate extends Opaque {} +final class Isolate extends Opaque {} typedef Dart_CurrentIsolateFT = Pointer Function(); typedef Dart_CurrentIsolateNFT = Pointer Function(); diff --git a/runtime/tests/vm/dart/thread_priority_macos_test.dart b/runtime/tests/vm/dart/thread_priority_macos_test.dart index 75e87d47faa..6de1ab6e33e 100644 --- a/runtime/tests/vm/dart/thread_priority_macos_test.dart +++ b/runtime/tests/vm/dart/thread_priority_macos_test.dart @@ -27,7 +27,7 @@ final pthreadGetSchedParam = DynamicLibrary.process() .lookupFunction('pthread_getschedparam'); // struct sched_param { int sched_priority; } -class SchedParam extends Struct { +final class SchedParam extends Struct { @Int32() external int schedPriority; } diff --git a/runtime/vm/compiler/ffi/native_type_vm_test.cc b/runtime/vm/compiler/ffi/native_type_vm_test.cc index 50a1e0792ac..cdc8f77df6e 100644 --- a/runtime/vm/compiler/ffi/native_type_vm_test.cc +++ b/runtime/vm/compiler/ffi/native_type_vm_test.cc @@ -60,7 +60,7 @@ ISOLATE_UNIT_TEST_CASE(Ffi_NativeType_Struct_FromAbstractType) { R"( import 'dart:ffi'; - class MyStruct extends Struct { + final class MyStruct extends Struct { @Int8() external int a0; diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc index 3971415b4d3..1f12995c6fe 100644 --- a/runtime/vm/dart_api_impl_test.cc +++ b/runtime/vm/dart_api_impl_test.cc @@ -3828,11 +3828,11 @@ TEST_CASE(DartAPI_WeakPersistentHandleErrors) { const char* kScriptChars = R"( import 'dart:ffi'; - class MyStruct extends Struct { + final class MyStruct extends Struct { external Pointer notEmpty; } - class MyUnion extends Union { + final class MyUnion extends Union { external Pointer notEmpty; } )"; @@ -3888,11 +3888,11 @@ TEST_CASE(DartAPI_FinalizableHandleErrors) { const char* kScriptChars = R"( import 'dart:ffi'; - class MyStruct extends Struct { + final class MyStruct extends Struct { external Pointer notEmpty; } - class MyUnion extends Union { + final class MyUnion extends Union { external Pointer notEmpty; } )"; diff --git a/samples/ffi/async/sample_async_callback.dart b/samples/ffi/async/sample_async_callback.dart index 12bdf66b0a0..96b3cff44a4 100644 --- a/samples/ffi/async/sample_async_callback.dart +++ b/samples/ffi/async/sample_async_callback.dart @@ -105,7 +105,7 @@ final stopWorkSimulator = final executeCallback = dl.lookupFunction), void Function(Pointer)>('ExecuteCallback'); -class Work extends Opaque {} +final class Work extends Opaque {} Future asyncSleep(int ms) { return new Future.delayed(Duration(milliseconds: ms)); diff --git a/samples/ffi/coordinate.dart b/samples/ffi/coordinate.dart index 5a51e33e394..94e7fbea35b 100644 --- a/samples/ffi/coordinate.dart +++ b/samples/ffi/coordinate.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; /// Sample struct for dart:ffi library. -class Coordinate extends Struct { +final class Coordinate extends Struct { @Double() external double x; diff --git a/samples/ffi/resource_management/arena_isolate_shutdown_sample.dart b/samples/ffi/resource_management/arena_isolate_shutdown_sample.dart index 1640554a7fd..3e8b7c3881f 100644 --- a/samples/ffi/resource_management/arena_isolate_shutdown_sample.dart +++ b/samples/ffi/resource_management/arena_isolate_shutdown_sample.dart @@ -86,4 +86,4 @@ final releaseResource = ffiTestDynamicLibrary.lookupFunction< void Function(Pointer)>("ReleaseResource"); /// Represents some opaque resource being managed by a library. -class SomeResource extends Opaque {} +final class SomeResource extends Opaque {} diff --git a/samples/ffi/resource_management/arena_sample.dart b/samples/ffi/resource_management/arena_sample.dart index 8436c15c804..94b1f6d8361 100644 --- a/samples/ffi/resource_management/arena_sample.dart +++ b/samples/ffi/resource_management/arena_sample.dart @@ -130,4 +130,4 @@ main() async { } /// Represents some opaque resource being managed by a library. -class SomeResource extends Opaque {} +final class SomeResource extends Opaque {} diff --git a/samples/ffi/resource_management/arena_zoned_sample.dart b/samples/ffi/resource_management/arena_zoned_sample.dart index a26cc75f9b0..39d15f19697 100644 --- a/samples/ffi/resource_management/arena_zoned_sample.dart +++ b/samples/ffi/resource_management/arena_zoned_sample.dart @@ -129,4 +129,4 @@ main() async { } /// Represents some opaque resource being managed by a library. -class SomeResource extends Opaque {} +final class SomeResource extends Opaque {} diff --git a/samples/ffi/sample_ffi_bitfield.dart b/samples/ffi/sample_ffi_bitfield.dart index 094ab07f61f..6ecb06d9e3c 100644 --- a/samples/ffi/sample_ffi_bitfield.dart +++ b/samples/ffi/sample_ffi_bitfield.dart @@ -16,7 +16,7 @@ import 'package:expect/expect.dart'; /// unsigned int strike : 1; /// unsigned int font : 4; /// } ScreenCellAttrs; -class ScreenCellAttrs extends Struct { +final class ScreenCellAttrs extends Struct { @Int16() external int bits; diff --git a/samples/ffi/sqlite/lib/src/bindings/types.dart b/samples/ffi/sqlite/lib/src/bindings/types.dart index 40edc87e44a..d94acee9f7a 100644 --- a/samples/ffi/sqlite/lib/src/bindings/types.dart +++ b/samples/ffi/sqlite/lib/src/bindings/types.dart @@ -13,7 +13,7 @@ import "dart:ffi"; /// is its destructor. There are many other interfaces (such as /// [sqlite3_prepare_v2()], [sqlite3_create_function()], and /// [sqlite3_busy_timeout()] to name but three) that are methods on an -class Database extends Opaque {} +final class Database extends Opaque {} /// SQL Statement Object /// @@ -36,7 +36,7 @@ class Database extends Opaque {} /// /// Refer to documentation on individual methods above for additional /// information. -class Statement extends Opaque {} +final class Statement extends Opaque {} /// Dynamically Typed Value Object /// @@ -72,4 +72,4 @@ class Statement extends Opaque {} /// [sqlite3_result_value()] and [sqlite3_bind_value()]. /// The [sqlite3_value_blob | sqlite3_value_type()] family of /// interfaces require protected sqlite3_value objects. -class Value extends Opaque {} +final class Value extends Opaque {} diff --git a/sdk/lib/_internal/vm/lib/ffi_dynamic_library_patch.dart b/sdk/lib/_internal/vm/lib/ffi_dynamic_library_patch.dart index 63690305143..356d3ca136a 100644 --- a/sdk/lib/_internal/vm/lib/ffi_dynamic_library_patch.dart +++ b/sdk/lib/_internal/vm/lib/ffi_dynamic_library_patch.dart @@ -16,7 +16,7 @@ external DynamicLibrary _executableLibrary(); @patch @pragma("vm:entry-point") -class DynamicLibrary { +final class DynamicLibrary { @patch factory DynamicLibrary.open(String path) { return _open(path); diff --git a/sdk/lib/_internal/vm/lib/ffi_native_finalizer_patch.dart b/sdk/lib/_internal/vm/lib/ffi_native_finalizer_patch.dart index 7c7d38deaf6..5e394da751d 100644 --- a/sdk/lib/_internal/vm/lib/ffi_native_finalizer_patch.dart +++ b/sdk/lib/_internal/vm/lib/ffi_native_finalizer_patch.dart @@ -10,18 +10,18 @@ import 'dart:typed_data'; @patch @pragma("vm:entry-point") -abstract class Finalizable {} +abstract interface class Finalizable {} @patch @pragma("vm:entry-point") -abstract class NativeFinalizer { +abstract final class NativeFinalizer { @patch factory NativeFinalizer(Pointer callback) = _NativeFinalizer; } @pragma("vm:entry-point") -class _NativeFinalizer extends FinalizerBase implements NativeFinalizer { +final class _NativeFinalizer extends FinalizerBase implements NativeFinalizer { @pragma("vm:recognized", "other") @pragma("vm:prefer-inline") external Pointer get _callback; diff --git a/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart b/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart index 76e9582fb53..0097dd33fba 100644 --- a/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart +++ b/sdk/lib/_internal/vm/lib/ffi_native_type_patch.dart @@ -12,72 +12,72 @@ import 'dart:typed_data'; // annotations directly, so it should never be instantiated at runtime. @patch @pragma("vm:entry-point") -abstract class NativeType {} +abstract final class NativeType {} @patch @pragma("vm:entry-point") -class _NativeInteger extends NativeType {} +final class _NativeInteger extends NativeType {} @patch @pragma("vm:entry-point") -class _NativeDouble extends NativeType {} +final class _NativeDouble extends NativeType {} @patch @pragma("vm:entry-point") -class Int8 extends _NativeInteger {} +final class Int8 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Int16 extends _NativeInteger {} +final class Int16 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Int32 extends _NativeInteger {} +final class Int32 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Int64 extends _NativeInteger {} +final class Int64 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Uint8 extends _NativeInteger {} +final class Uint8 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Uint16 extends _NativeInteger {} +final class Uint16 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Uint32 extends _NativeInteger {} +final class Uint32 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Uint64 extends _NativeInteger {} +final class Uint64 extends _NativeInteger {} @patch @pragma("vm:entry-point") -class Float extends _NativeDouble {} +final class Float extends _NativeDouble {} @patch @pragma("vm:entry-point") -class Double extends _NativeDouble {} +final class Double extends _NativeDouble {} @patch @pragma("vm:entry-point") -abstract class Bool extends NativeType {} +abstract final class Bool extends NativeType {} @patch @pragma("vm:entry-point") -abstract class Void extends NativeType {} +abstract final class Void extends NativeType {} @patch @pragma("vm:entry-point") -abstract class Handle extends NativeType {} +abstract final class Handle extends NativeType {} @patch @pragma("vm:entry-point") -abstract class NativeFunction extends NativeType {} +abstract final class NativeFunction extends NativeType {} @patch @pragma("vm:entry-point") -abstract class VarArgs extends NativeType {} +abstract final class VarArgs extends NativeType {} diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart index f9611e79ffe..f06582e9553 100644 --- a/sdk/lib/_internal/vm/lib/ffi_patch.dart +++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart @@ -155,7 +155,7 @@ external Pointer _pointerFromFunction( @patch @pragma("vm:entry-point") -class Pointer { +final class Pointer { @patch factory Pointer.fromAddress(int ptr) => _fromAddress(ptr); @@ -187,7 +187,7 @@ class Pointer { @patch @pragma("vm:entry-point") -class Array { +final class Array { @pragma("vm:entry-point") final Object _typedDataBase; @@ -229,14 +229,14 @@ external int _abi(); @patch @pragma("vm:entry-point") -class Abi { +final class Abi { @patch @pragma("vm:prefer-inline") factory Abi.current() => values[_abi()]; } @pragma("vm:entry-point") -class _FfiAbiSpecificMapping { +final class _FfiAbiSpecificMapping { /// A more concise representation of `AbiSpecificIntegerMapping`. /// /// `AbiSpecificIntegerMapping` contain a mapping from Abi to DartType. @@ -1031,7 +1031,7 @@ external int _dartApiMajorVersion(); external int _dartApiMinorVersion(); @patch -abstract class NativeApi { +abstract final class NativeApi { @patch static Pointer)>> get postCObject => @@ -1065,7 +1065,7 @@ abstract class NativeApi { // patch class of [Array]. @patch -class _ArraySize implements Array { +final class _ArraySize implements Array { _checkIndex(int index) => throw UnsupportedError('_ArraySize._checkIndex'); List get _nestedDimensions => diff --git a/sdk/lib/_internal/vm/lib/ffi_struct_patch.dart b/sdk/lib/_internal/vm/lib/ffi_struct_patch.dart index 8994c079f19..a1037d63667 100644 --- a/sdk/lib/_internal/vm/lib/ffi_struct_patch.dart +++ b/sdk/lib/_internal/vm/lib/ffi_struct_patch.dart @@ -8,16 +8,16 @@ import 'dart:isolate'; import 'dart:typed_data'; @pragma("vm:entry-point") -abstract class _Compound extends NativeType {} +abstract final class _Compound extends NativeType {} @pragma("vm:entry-point") -abstract class Struct extends _Compound {} +abstract base class Struct extends _Compound {} @pragma("vm:entry-point") -abstract class Union extends _Compound {} +abstract base class Union extends _Compound {} @pragma("vm:entry-point") -class _FfiStructLayout { +final class _FfiStructLayout { @pragma("vm:entry-point") final List fieldTypes; @@ -28,7 +28,7 @@ class _FfiStructLayout { } @pragma("vm:entry-point") -class _FfiInlineArray { +final class _FfiInlineArray { @pragma("vm:entry-point") final Type elementType; @pragma("vm:entry-point") diff --git a/sdk/lib/ffi/abi_specific.dart b/sdk/lib/ffi/abi_specific.dart index 85e6a1e0a5d..1e40395af9f 100644 --- a/sdk/lib/ffi/abi_specific.dart +++ b/sdk/lib/ffi/abi_specific.dart @@ -40,12 +40,12 @@ part of dart.ffi; /// Abi.windowsIA32: Uint32(), /// Abi.windowsX64: Uint64(), /// }) -/// class UintPtr extends AbiSpecificInteger { +/// final class UintPtr extends AbiSpecificInteger { /// const UintPtr(); /// } /// ``` @Since('2.16') -class AbiSpecificInteger extends NativeType { +base class AbiSpecificInteger extends NativeType { const AbiSpecificInteger(); } @@ -53,7 +53,7 @@ class AbiSpecificInteger extends NativeType { /// /// See documentation on [AbiSpecificInteger]. @Since('2.16') -class AbiSpecificIntegerMapping { +final class AbiSpecificIntegerMapping { final Map mapping; const AbiSpecificIntegerMapping(this.mapping); diff --git a/sdk/lib/ffi/annotations.dart b/sdk/lib/ffi/annotations.dart index e384cb33498..ce3d648d512 100644 --- a/sdk/lib/ffi/annotations.dart +++ b/sdk/lib/ffi/annotations.dart @@ -4,7 +4,7 @@ part of dart.ffi; -class DartRepresentationOf { +final class DartRepresentationOf { /// Represents the Dart type corresponding to a [NativeType]. /// /// [Int8] -> [int] @@ -25,7 +25,7 @@ class DartRepresentationOf { const DartRepresentationOf(String nativeType); } -class Unsized { +final class Unsized { const Unsized(); } diff --git a/sdk/lib/ffi/c_type.dart b/sdk/lib/ffi/c_type.dart index 8a961475ba5..67c128e0468 100644 --- a/sdk/lib/ffi/c_type.dart +++ b/sdk/lib/ffi/c_type.dart @@ -45,7 +45,7 @@ part of dart.ffi; Abi.windowsIA32: Int8(), Abi.windowsX64: Int8(), }) -class Char extends AbiSpecificInteger { +final class Char extends AbiSpecificInteger { const Char(); } @@ -83,7 +83,7 @@ class Char extends AbiSpecificInteger { Abi.windowsIA32: Int8(), Abi.windowsX64: Int8(), }) -class SignedChar extends AbiSpecificInteger { +final class SignedChar extends AbiSpecificInteger { const SignedChar(); } @@ -121,7 +121,7 @@ class SignedChar extends AbiSpecificInteger { Abi.windowsIA32: Uint8(), Abi.windowsX64: Uint8(), }) -class UnsignedChar extends AbiSpecificInteger { +final class UnsignedChar extends AbiSpecificInteger { const UnsignedChar(); } @@ -159,7 +159,7 @@ class UnsignedChar extends AbiSpecificInteger { Abi.windowsIA32: Int16(), Abi.windowsX64: Int16(), }) -class Short extends AbiSpecificInteger { +final class Short extends AbiSpecificInteger { const Short(); } @@ -197,7 +197,7 @@ class Short extends AbiSpecificInteger { Abi.windowsIA32: Uint16(), Abi.windowsX64: Uint16(), }) -class UnsignedShort extends AbiSpecificInteger { +final class UnsignedShort extends AbiSpecificInteger { const UnsignedShort(); } @@ -235,7 +235,7 @@ class UnsignedShort extends AbiSpecificInteger { Abi.windowsIA32: Int32(), Abi.windowsX64: Int32(), }) -class Int extends AbiSpecificInteger { +final class Int extends AbiSpecificInteger { const Int(); } @@ -273,7 +273,7 @@ class Int extends AbiSpecificInteger { Abi.windowsIA32: Uint32(), Abi.windowsX64: Uint32(), }) -class UnsignedInt extends AbiSpecificInteger { +final class UnsignedInt extends AbiSpecificInteger { const UnsignedInt(); } @@ -312,7 +312,7 @@ class UnsignedInt extends AbiSpecificInteger { Abi.windowsIA32: Int32(), Abi.windowsX64: Int32(), }) -class Long extends AbiSpecificInteger { +final class Long extends AbiSpecificInteger { const Long(); } @@ -351,7 +351,7 @@ class Long extends AbiSpecificInteger { Abi.windowsIA32: Uint32(), Abi.windowsX64: Uint32(), }) -class UnsignedLong extends AbiSpecificInteger { +final class UnsignedLong extends AbiSpecificInteger { const UnsignedLong(); } @@ -389,7 +389,7 @@ class UnsignedLong extends AbiSpecificInteger { Abi.windowsIA32: Int64(), Abi.windowsX64: Int64(), }) -class LongLong extends AbiSpecificInteger { +final class LongLong extends AbiSpecificInteger { const LongLong(); } @@ -427,7 +427,7 @@ class LongLong extends AbiSpecificInteger { Abi.windowsIA32: Uint64(), Abi.windowsX64: Uint64(), }) -class UnsignedLongLong extends AbiSpecificInteger { +final class UnsignedLongLong extends AbiSpecificInteger { const UnsignedLongLong(); } @@ -460,7 +460,7 @@ class UnsignedLongLong extends AbiSpecificInteger { Abi.windowsIA32: Int32(), Abi.windowsX64: Int64(), }) -class IntPtr extends AbiSpecificInteger { +final class IntPtr extends AbiSpecificInteger { const IntPtr(); } @@ -494,7 +494,7 @@ class IntPtr extends AbiSpecificInteger { Abi.windowsIA32: Uint32(), Abi.windowsX64: Uint64(), }) -class UintPtr extends AbiSpecificInteger { +final class UintPtr extends AbiSpecificInteger { const UintPtr(); } @@ -528,7 +528,7 @@ class UintPtr extends AbiSpecificInteger { Abi.windowsIA32: Uint32(), Abi.windowsX64: Uint64(), }) -class Size extends AbiSpecificInteger { +final class Size extends AbiSpecificInteger { const Size(); } @@ -565,6 +565,6 @@ class Size extends AbiSpecificInteger { Abi.windowsIA32: Uint16(), Abi.windowsX64: Uint16(), }) -class WChar extends AbiSpecificInteger { +final class WChar extends AbiSpecificInteger { const WChar(); } diff --git a/sdk/lib/ffi/dynamic_library.dart b/sdk/lib/ffi/dynamic_library.dart index e31b2d7fa22..2d919dd347f 100644 --- a/sdk/lib/ffi/dynamic_library.dart +++ b/sdk/lib/ffi/dynamic_library.dart @@ -8,7 +8,7 @@ part of dart.ffi; /// /// A dynamically loaded library is a mapping from symbols to memory addresses. /// These memory addresses can be accessed through [lookup]. -class DynamicLibrary { +final class DynamicLibrary { /// Creates a [DynamicLibrary] holding all global symbols. /// /// Any symbol in a library currently loaded with global visibility diff --git a/sdk/lib/ffi/ffi.dart b/sdk/lib/ffi/ffi.dart index af6da07980c..2ddc8caab44 100644 --- a/sdk/lib/ffi/ffi.dart +++ b/sdk/lib/ffi/ffi.dart @@ -39,7 +39,7 @@ final Pointer nullptr = Pointer.fromAddress(0); /// Represents a pointer into the native C memory. Cannot be extended. @pragma('vm:entry-point') @pragma("wasm:entry-point") -class Pointer extends NativeType { +final class Pointer extends NativeType { /// Construction from raw integer. external factory Pointer.fromAddress(int ptr); @@ -85,11 +85,11 @@ class Pointer extends NativeType { /// A fixed-sized array of [T]s. @Since('2.13') -class Array extends NativeType { +final class Array extends NativeType { /// Const constructor to specify [Array] dimensions in [Struct]s. /// /// ```dart - /// class MyStruct extends Struct { + /// final class MyStruct extends Struct { /// @Array(8) /// external Array inlineArray; /// @@ -108,7 +108,7 @@ class Array extends NativeType { /// Const constructor to specify [Array] dimensions in [Struct]s. /// /// ```dart - /// class MyStruct extends Struct { + /// final class MyStruct extends Struct { /// @Array.multi([2, 2, 2]) /// external Array>> threeDimensionalInlineArray; /// @@ -121,7 +121,7 @@ class Array extends NativeType { const factory Array.multi(List dimensions) = _ArraySize.multi; } -class _ArraySize implements Array { +final class _ArraySize implements Array { final int? dimension1; final int? dimension2; final int? dimension3; @@ -848,14 +848,14 @@ extension NativePort on SendPort { /// Opaque, not exposing it's members. @Since('2.8') -class Dart_CObject extends Opaque {} +final class Dart_CObject extends Opaque {} typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer); /// Utilities for accessing the Dart VM API from Dart code or /// from C code via `dart_api_dl.h`. @Since('2.8') -abstract class NativeApi { +abstract final class NativeApi { /// On breaking changes the major version is increased. /// /// The versioning covers the API surface in `dart_api_dl.h`. @@ -918,7 +918,7 @@ abstract class NativeApi { /// NOTE: This experimental feature is replaced by [Native]. @Since('2.14') @Deprecated('Use Native instead.') -class FfiNative { +final class FfiNative { final String nativeName; /// Specifies whether the function is a leaf function. @@ -968,7 +968,7 @@ class FfiNative { /// /// NOTE: This is an experimental feature and may change in the future. @Since('2.19') -class Native { +final class Native { /// The native symbol to be resolved, if not using the default. /// /// If not specified, the default symbol used for native function lookup @@ -1091,7 +1091,7 @@ class Native { /// /// NOTE: This is an experimental feature and may change in the future. @Since('2.19') -class DefaultAsset { +final class DefaultAsset { /// The default asset name for [Native] external functions in this library. final String id; diff --git a/sdk/lib/ffi/native_finalizer.dart b/sdk/lib/ffi/native_finalizer.dart index 672b4273afa..bba05b1ef61 100644 --- a/sdk/lib/ffi/native_finalizer.dart +++ b/sdk/lib/ffi/native_finalizer.dart @@ -219,7 +219,7 @@ part of dart.ffi; // TODO(http://dartbug.com/44395): Add implicit await to Dart implementation. // This will fix `useAsync2` above. @Since('2.17') -abstract class Finalizable { +abstract interface class Finalizable { factory Finalizable._() => throw UnsupportedError(""); } @@ -335,10 +335,10 @@ typedef NativeFinalizerFunction /// .asFunction)>(); /// } /// -/// class _NativeDatabase extends Opaque {} +/// final class _NativeDatabase extends Opaque {} /// ``` @Since('2.17') -abstract class NativeFinalizer { +abstract final class NativeFinalizer { /// Creates a finalizer with the given finalization callback. /// /// The [callback] must be a native function which can be executed outside of diff --git a/sdk/lib/ffi/native_type.dart b/sdk/lib/ffi/native_type.dart index 049f61d746f..8a3b17160a9 100644 --- a/sdk/lib/ffi/native_type.dart +++ b/sdk/lib/ffi/native_type.dart @@ -8,7 +8,7 @@ part of dart.ffi; /// /// [NativeType]'s subtypes are not constructible in the Dart code and serve /// purely as markers in type signatures. -abstract class NativeType { +abstract final class NativeType { const NativeType(); } @@ -17,13 +17,13 @@ abstract class NativeType { /// [Opaque]'s subtypes are not constructible in the Dart code and serve purely /// as markers in type signatures. @Since('2.12') -abstract class Opaque extends NativeType {} +abstract base class Opaque extends NativeType {} /// [_NativeInteger]'s subtypes represent a native integer in C. /// /// [_NativeInteger]'s subtypes are not constructible in the Dart code and serve /// purely as markers in type signatures. -class _NativeInteger extends NativeType { +final class _NativeInteger extends NativeType { const _NativeInteger(); } @@ -31,7 +31,7 @@ class _NativeInteger extends NativeType { /// /// [_NativeDouble]'s subtypes are not constructible in the Dart code and serve /// purely as markers in type signatures. -class _NativeDouble extends NativeType { +final class _NativeDouble extends NativeType { const _NativeDouble(); } @@ -39,7 +39,7 @@ class _NativeDouble extends NativeType { /// /// [Int8] is not constructible in the Dart code and serves purely as marker in /// type signatures. -class Int8 extends _NativeInteger { +final class Int8 extends _NativeInteger { const Int8(); } @@ -47,7 +47,7 @@ class Int8 extends _NativeInteger { /// /// [Int16] is not constructible in the Dart code and serves purely as marker in /// type signatures. -class Int16 extends _NativeInteger { +final class Int16 extends _NativeInteger { const Int16(); } @@ -55,7 +55,7 @@ class Int16 extends _NativeInteger { /// /// [Int32] is not constructible in the Dart code and serves purely as marker in /// type signatures. -class Int32 extends _NativeInteger { +final class Int32 extends _NativeInteger { const Int32(); } @@ -63,7 +63,7 @@ class Int32 extends _NativeInteger { /// /// [Int64] is not constructible in the Dart code and serves purely as marker in /// type signatures. -class Int64 extends _NativeInteger { +final class Int64 extends _NativeInteger { const Int64(); } @@ -71,7 +71,7 @@ class Int64 extends _NativeInteger { /// /// [Uint8] is not constructible in the Dart code and serves purely as marker in /// type signatures. -class Uint8 extends _NativeInteger { +final class Uint8 extends _NativeInteger { const Uint8(); } @@ -79,7 +79,7 @@ class Uint8 extends _NativeInteger { /// /// [Uint16] is not constructible in the Dart code and serves purely as marker /// in type signatures. -class Uint16 extends _NativeInteger { +final class Uint16 extends _NativeInteger { const Uint16(); } @@ -87,7 +87,7 @@ class Uint16 extends _NativeInteger { /// /// [Uint32] is not constructible in the Dart code and serves purely as marker /// in type signatures. -class Uint32 extends _NativeInteger { +final class Uint32 extends _NativeInteger { const Uint32(); } @@ -95,7 +95,7 @@ class Uint32 extends _NativeInteger { /// /// [Uint64] is not constructible in the Dart code and serves purely as marker /// in type signatures. -class Uint64 extends _NativeInteger { +final class Uint64 extends _NativeInteger { const Uint64(); } @@ -103,7 +103,7 @@ class Uint64 extends _NativeInteger { /// /// [Float] is not constructible in the Dart code and serves purely as marker /// in type signatures. -class Float extends _NativeDouble { +final class Float extends _NativeDouble { const Float(); } @@ -111,7 +111,7 @@ class Float extends _NativeDouble { /// /// [Double] is not constructible in the Dart code and serves purely as marker /// in type signatures. -class Double extends _NativeDouble { +final class Double extends _NativeDouble { const Double(); } @@ -120,7 +120,7 @@ class Double extends _NativeDouble { /// [Bool] is not constructible in the Dart code and serves purely as marker /// in type signatures. @Since('2.15') -class Bool extends NativeType { +final class Bool extends NativeType { const Bool(); } @@ -129,21 +129,21 @@ class Bool extends NativeType { /// [Void] is not constructible in the Dart code and serves purely as marker in /// type signatures. @unsized -abstract class Void extends NativeType {} +abstract final class Void extends NativeType {} /// Represents `Dart_Handle` in C. /// /// [Handle] is not constructible in the Dart code and serves purely as marker in /// type signatures. @Since('2.9') -abstract class Handle extends NativeType {} +abstract final class Handle extends NativeType {} /// Represents a function type in C. /// /// [NativeFunction] is not constructible in the Dart code and serves purely as /// marker in type signatures. @unsized -abstract class NativeFunction extends NativeType {} +abstract final class NativeFunction extends NativeType {} /// The types of variadic arguments passed in C. /// @@ -210,4 +210,4 @@ abstract class NativeFunction extends NativeType {} /// [VarArgs] is not constructible in the Dart code and serves purely as marker /// in type signatures. @Since('3.0') -abstract class VarArgs extends NativeType {} +abstract final class VarArgs extends NativeType {} diff --git a/sdk/lib/ffi/struct.dart b/sdk/lib/ffi/struct.dart index 3f84c42e382..968fed0f933 100644 --- a/sdk/lib/ffi/struct.dart +++ b/sdk/lib/ffi/struct.dart @@ -9,7 +9,7 @@ part of dart.ffi; /// FFI struct types should extend [Struct]. For more information see the /// documentation on this class. @pragma("wasm:entry-point") -abstract class _Compound extends NativeType { +abstract final class _Compound extends NativeType { @pragma("vm:entry-point") final Object _typedDataBase; @@ -40,7 +40,7 @@ abstract class _Compound extends NativeType { /// ``` /// /// ```dart -/// class MyStruct extends Struct { +/// final class MyStruct extends Struct { /// @Int32() /// external int a; /// @@ -62,7 +62,7 @@ abstract class _Compound extends NativeType { /// from a [Pointer] or created by ffi calls or callbacks. They cannot be /// created by a generative constructor. @Since('2.12') -abstract class Struct extends _Compound { +abstract base class Struct extends _Compound { /// Construct a reference to the [nullptr]. /// /// Use [StructPointer]'s `.ref` to gain references to native memory backed @@ -78,7 +78,7 @@ abstract class Struct extends _Compound { /// /// Valid values for [memberAlignment] are 1, 2, 4, 8, and 16. @Since('2.13') -class Packed { +final class Packed { final int memberAlignment; const Packed(this.memberAlignment); diff --git a/sdk/lib/ffi/union.dart b/sdk/lib/ffi/union.dart index 8d2ee9ebd97..c6a9167c3eb 100644 --- a/sdk/lib/ffi/union.dart +++ b/sdk/lib/ffi/union.dart @@ -26,7 +26,7 @@ part of dart.ffi; /// ``` /// /// ```dart -/// class MyUnion extends Union { +/// final class MyUnion extends Union { /// @Int32() /// external int a; /// @@ -47,7 +47,7 @@ part of dart.ffi; /// by native memory. The may allocated via allocation or loaded from a /// [Pointer], but cannot be created by a generative constructor. @Since('2.14') -abstract class Union extends _Compound { +abstract base class Union extends _Compound { /// Construct a reference to the [nullptr]. /// /// Use [UnionPointer]'s `.ref` to gain references to native memory backed diff --git a/tests/ffi/abi_specific_int_incomplete_aot_test.dart b/tests/ffi/abi_specific_int_incomplete_aot_test.dart index 0b77d4368e7..76c599c601a 100644 --- a/tests/ffi/abi_specific_int_incomplete_aot_test.dart +++ b/tests/ffi/abi_specific_int_incomplete_aot_test.dart @@ -12,7 +12,7 @@ const notTestingOn = Abi.fuchsiaArm64; @AbiSpecificIntegerMapping({ notTestingOn: Int8(), }) -class Incomplete extends AbiSpecificInteger { +final class Incomplete extends AbiSpecificInteger { const Incomplete(); } diff --git a/tests/ffi/abi_specific_int_incomplete_jit_test.dart b/tests/ffi/abi_specific_int_incomplete_jit_test.dart index dfd8c1e42f6..8a0dd413f50 100644 --- a/tests/ffi/abi_specific_int_incomplete_jit_test.dart +++ b/tests/ffi/abi_specific_int_incomplete_jit_test.dart @@ -15,7 +15,7 @@ const notTestingOn = Abi.fuchsiaArm64; @AbiSpecificIntegerMapping({ notTestingOn: Int8(), }) -class Incomplete extends AbiSpecificInteger { +final class Incomplete extends AbiSpecificInteger { const Incomplete(); } @@ -60,7 +60,7 @@ void testStoreLoadIndexed() { calloc.free(p); } -class IncompleteStruct extends Struct { +final class IncompleteStruct extends Struct { @Incomplete() external int a0; @@ -79,7 +79,7 @@ void testStruct() { calloc.free(p); } -class IncompleteArrayStruct extends Struct { +final class IncompleteArrayStruct extends Struct { @Array(100) external Array a0; } @@ -99,7 +99,7 @@ void testInlineArray() { const _dim1 = 8; const _dim2 = 4; -class IncompleteArrayArrayStruct extends Struct { +final class IncompleteArrayArrayStruct extends Struct { @Array(_dim1, _dim2) external Array> a0; } diff --git a/tests/ffi/abi_specific_int_test.dart b/tests/ffi/abi_specific_int_test.dart index cea45b146d8..0dd94073376 100644 --- a/tests/ffi/abi_specific_int_test.dart +++ b/tests/ffi/abi_specific_int_test.dart @@ -42,7 +42,7 @@ void testStoreLoadIndexed() { calloc.free(p); } -class WCharStruct extends Struct { +final class WCharStruct extends Struct { @WChar() external int a0; @@ -59,7 +59,7 @@ void testStruct() { calloc.free(p); } -class WCharArrayStruct extends Struct { +final class WCharArrayStruct extends Struct { @Array(100) external Array a0; } @@ -80,7 +80,7 @@ const _dim0 = 3; const _dim1 = 8; const _dim2 = 4; -class WCharArrayArrayStruct extends Struct { +final class WCharArrayArrayStruct extends Struct { @Array(_dim1, _dim2) external Array> a0; } diff --git a/tests/ffi/coordinate.dart b/tests/ffi/coordinate.dart index 080bf1888d9..54eb8699ea9 100644 --- a/tests/ffi/coordinate.dart +++ b/tests/ffi/coordinate.dart @@ -7,7 +7,7 @@ library FfiTest; import 'dart:ffi'; /// Sample struct for dart:ffi library. -class Coordinate extends Struct { +final class Coordinate extends Struct { @Double() external double x; diff --git a/tests/ffi/coordinate_nnbd_workaround.dart b/tests/ffi/coordinate_nnbd_workaround.dart index 42a66832a79..c357b78b970 100644 --- a/tests/ffi/coordinate_nnbd_workaround.dart +++ b/tests/ffi/coordinate_nnbd_workaround.dart @@ -9,7 +9,7 @@ library FfiTest; import 'dart:ffi'; /// Sample struct for dart:ffi library. -class Coordinate extends Struct { +final class Coordinate extends Struct { @Double() external double get x; external set x(double v); diff --git a/tests/ffi/expando_test.dart b/tests/ffi/expando_test.dart index 473fc6f0293..1d175c928a7 100644 --- a/tests/ffi/expando_test.dart +++ b/tests/ffi/expando_test.dart @@ -27,7 +27,7 @@ void testPointer() { }); } -class MyStruct extends Struct { +final class MyStruct extends Struct { external Pointer notEmpty; } diff --git a/tests/ffi/extension_methods_test.dart b/tests/ffi/extension_methods_test.dart index fb7137871a6..cf79a6bdb58 100644 --- a/tests/ffi/extension_methods_test.dart +++ b/tests/ffi/extension_methods_test.dart @@ -92,12 +92,12 @@ testCompoundLoadAndStore() { calloc.free(bars); } -class Foo extends Struct { +final class Foo extends Struct { @Int8() external int a; } -class Bar extends Union { +final class Bar extends Union { external Foo foo; @Int32() external int baz; diff --git a/tests/ffi/function_structs_by_value_generated_compounds.dart b/tests/ffi/function_structs_by_value_generated_compounds.dart index 666ef20e1d9..80f094a21c1 100644 --- a/tests/ffi/function_structs_by_value_generated_compounds.dart +++ b/tests/ffi/function_structs_by_value_generated_compounds.dart @@ -7,21 +7,21 @@ import 'dart:ffi'; -class Struct1ByteBool extends Struct { +final class Struct1ByteBool extends Struct { @Bool() external bool a0; String toString() => "(${a0})"; } -class Struct1ByteInt extends Struct { +final class Struct1ByteInt extends Struct { @Int8() external int a0; String toString() => "(${a0})"; } -class Struct3BytesHomogeneousUint8 extends Struct { +final class Struct3BytesHomogeneousUint8 extends Struct { @Uint8() external int a0; @@ -34,7 +34,7 @@ class Struct3BytesHomogeneousUint8 extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct3BytesInt2ByteAligned extends Struct { +final class Struct3BytesInt2ByteAligned extends Struct { @Int16() external int a0; @@ -44,7 +44,7 @@ class Struct3BytesInt2ByteAligned extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct4BytesHomogeneousInt16 extends Struct { +final class Struct4BytesHomogeneousInt16 extends Struct { @Int16() external int a0; @@ -54,14 +54,14 @@ class Struct4BytesHomogeneousInt16 extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct4BytesFloat extends Struct { +final class Struct4BytesFloat extends Struct { @Float() external double a0; String toString() => "(${a0})"; } -class Struct7BytesHomogeneousUint8 extends Struct { +final class Struct7BytesHomogeneousUint8 extends Struct { @Uint8() external int a0; @@ -86,7 +86,7 @@ class Struct7BytesHomogeneousUint8 extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6})"; } -class Struct7BytesInt4ByteAligned extends Struct { +final class Struct7BytesInt4ByteAligned extends Struct { @Int32() external int a0; @@ -99,7 +99,7 @@ class Struct7BytesInt4ByteAligned extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct8BytesInt extends Struct { +final class Struct8BytesInt extends Struct { @Int16() external int a0; @@ -112,7 +112,7 @@ class Struct8BytesInt extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct8BytesHomogeneousFloat extends Struct { +final class Struct8BytesHomogeneousFloat extends Struct { @Float() external double a0; @@ -122,14 +122,14 @@ class Struct8BytesHomogeneousFloat extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct8BytesFloat extends Struct { +final class Struct8BytesFloat extends Struct { @Double() external double a0; String toString() => "(${a0})"; } -class Struct8BytesMixed extends Struct { +final class Struct8BytesMixed extends Struct { @Float() external double a0; @@ -142,7 +142,7 @@ class Struct8BytesMixed extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct9BytesHomogeneousUint8 extends Struct { +final class Struct9BytesHomogeneousUint8 extends Struct { @Uint8() external int a0; @@ -174,7 +174,7 @@ class Struct9BytesHomogeneousUint8 extends Struct { "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8})"; } -class Struct9BytesInt4Or8ByteAligned extends Struct { +final class Struct9BytesInt4Or8ByteAligned extends Struct { @Int64() external int a0; @@ -184,7 +184,7 @@ class Struct9BytesInt4Or8ByteAligned extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct10BytesHomogeneousBool extends Struct { +final class Struct10BytesHomogeneousBool extends Struct { @Bool() external bool a0; @@ -219,7 +219,7 @@ class Struct10BytesHomogeneousBool extends Struct { "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9})"; } -class Struct12BytesHomogeneousFloat extends Struct { +final class Struct12BytesHomogeneousFloat extends Struct { @Float() external double a0; @@ -232,7 +232,7 @@ class Struct12BytesHomogeneousFloat extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct16BytesHomogeneousFloat extends Struct { +final class Struct16BytesHomogeneousFloat extends Struct { @Float() external double a0; @@ -248,7 +248,7 @@ class Struct16BytesHomogeneousFloat extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3})"; } -class Struct16BytesMixed extends Struct { +final class Struct16BytesMixed extends Struct { @Double() external double a0; @@ -258,7 +258,7 @@ class Struct16BytesMixed extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct16BytesMixed2 extends Struct { +final class Struct16BytesMixed2 extends Struct { @Float() external double a0; @@ -274,7 +274,7 @@ class Struct16BytesMixed2 extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3})"; } -class Struct17BytesInt extends Struct { +final class Struct17BytesInt extends Struct { @Int64() external int a0; @@ -287,7 +287,7 @@ class Struct17BytesInt extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct19BytesHomogeneousUint8 extends Struct { +final class Struct19BytesHomogeneousUint8 extends Struct { @Uint8() external int a0; @@ -349,7 +349,7 @@ class Struct19BytesHomogeneousUint8 extends Struct { "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11}, ${a12}, ${a13}, ${a14}, ${a15}, ${a16}, ${a17}, ${a18})"; } -class Struct20BytesHomogeneousInt32 extends Struct { +final class Struct20BytesHomogeneousInt32 extends Struct { @Int32() external int a0; @@ -368,7 +368,7 @@ class Struct20BytesHomogeneousInt32 extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"; } -class Struct20BytesHomogeneousFloat extends Struct { +final class Struct20BytesHomogeneousFloat extends Struct { @Float() external double a0; @@ -387,7 +387,7 @@ class Struct20BytesHomogeneousFloat extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"; } -class Struct32BytesHomogeneousDouble extends Struct { +final class Struct32BytesHomogeneousDouble extends Struct { @Double() external double a0; @@ -403,7 +403,7 @@ class Struct32BytesHomogeneousDouble extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3})"; } -class Struct40BytesHomogeneousDouble extends Struct { +final class Struct40BytesHomogeneousDouble extends Struct { @Double() external double a0; @@ -422,7 +422,7 @@ class Struct40BytesHomogeneousDouble extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3}, ${a4})"; } -class Struct1024BytesHomogeneousUint64 extends Struct { +final class Struct1024BytesHomogeneousUint64 extends Struct { @Uint64() external int a0; @@ -811,7 +811,7 @@ class Struct1024BytesHomogeneousUint64 extends Struct { "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6}, ${a7}, ${a8}, ${a9}, ${a10}, ${a11}, ${a12}, ${a13}, ${a14}, ${a15}, ${a16}, ${a17}, ${a18}, ${a19}, ${a20}, ${a21}, ${a22}, ${a23}, ${a24}, ${a25}, ${a26}, ${a27}, ${a28}, ${a29}, ${a30}, ${a31}, ${a32}, ${a33}, ${a34}, ${a35}, ${a36}, ${a37}, ${a38}, ${a39}, ${a40}, ${a41}, ${a42}, ${a43}, ${a44}, ${a45}, ${a46}, ${a47}, ${a48}, ${a49}, ${a50}, ${a51}, ${a52}, ${a53}, ${a54}, ${a55}, ${a56}, ${a57}, ${a58}, ${a59}, ${a60}, ${a61}, ${a62}, ${a63}, ${a64}, ${a65}, ${a66}, ${a67}, ${a68}, ${a69}, ${a70}, ${a71}, ${a72}, ${a73}, ${a74}, ${a75}, ${a76}, ${a77}, ${a78}, ${a79}, ${a80}, ${a81}, ${a82}, ${a83}, ${a84}, ${a85}, ${a86}, ${a87}, ${a88}, ${a89}, ${a90}, ${a91}, ${a92}, ${a93}, ${a94}, ${a95}, ${a96}, ${a97}, ${a98}, ${a99}, ${a100}, ${a101}, ${a102}, ${a103}, ${a104}, ${a105}, ${a106}, ${a107}, ${a108}, ${a109}, ${a110}, ${a111}, ${a112}, ${a113}, ${a114}, ${a115}, ${a116}, ${a117}, ${a118}, ${a119}, ${a120}, ${a121}, ${a122}, ${a123}, ${a124}, ${a125}, ${a126}, ${a127})"; } -class StructAlignmentInt16 extends Struct { +final class StructAlignmentInt16 extends Struct { @Int8() external int a0; @@ -824,7 +824,7 @@ class StructAlignmentInt16 extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class StructAlignmentInt32 extends Struct { +final class StructAlignmentInt32 extends Struct { @Int8() external int a0; @@ -837,7 +837,7 @@ class StructAlignmentInt32 extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class StructAlignmentInt64 extends Struct { +final class StructAlignmentInt64 extends Struct { @Int8() external int a0; @@ -850,7 +850,7 @@ class StructAlignmentInt64 extends Struct { String toString() => "(${a0}, ${a1}, ${a2})"; } -class Struct8BytesNestedInt extends Struct { +final class Struct8BytesNestedInt extends Struct { external Struct4BytesHomogeneousInt16 a0; external Struct4BytesHomogeneousInt16 a1; @@ -858,7 +858,7 @@ class Struct8BytesNestedInt extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct8BytesNestedFloat extends Struct { +final class Struct8BytesNestedFloat extends Struct { external Struct4BytesFloat a0; external Struct4BytesFloat a1; @@ -866,7 +866,7 @@ class Struct8BytesNestedFloat extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct8BytesNestedFloat2 extends Struct { +final class Struct8BytesNestedFloat2 extends Struct { external Struct4BytesFloat a0; @Float() @@ -875,7 +875,7 @@ class Struct8BytesNestedFloat2 extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct8BytesNestedMixed extends Struct { +final class Struct8BytesNestedMixed extends Struct { external Struct4BytesHomogeneousInt16 a0; external Struct4BytesFloat a1; @@ -883,7 +883,7 @@ class Struct8BytesNestedMixed extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct16BytesNestedInt extends Struct { +final class Struct16BytesNestedInt extends Struct { external Struct8BytesNestedInt a0; external Struct8BytesNestedInt a1; @@ -891,7 +891,7 @@ class Struct16BytesNestedInt extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct32BytesNestedInt extends Struct { +final class Struct32BytesNestedInt extends Struct { external Struct16BytesNestedInt a0; external Struct16BytesNestedInt a1; @@ -899,7 +899,7 @@ class Struct32BytesNestedInt extends Struct { String toString() => "(${a0}, ${a1})"; } -class StructNestedIntStructAlignmentInt16 extends Struct { +final class StructNestedIntStructAlignmentInt16 extends Struct { external StructAlignmentInt16 a0; external StructAlignmentInt16 a1; @@ -907,7 +907,7 @@ class StructNestedIntStructAlignmentInt16 extends Struct { String toString() => "(${a0}, ${a1})"; } -class StructNestedIntStructAlignmentInt32 extends Struct { +final class StructNestedIntStructAlignmentInt32 extends Struct { external StructAlignmentInt32 a0; external StructAlignmentInt32 a1; @@ -915,7 +915,7 @@ class StructNestedIntStructAlignmentInt32 extends Struct { String toString() => "(${a0}, ${a1})"; } -class StructNestedIntStructAlignmentInt64 extends Struct { +final class StructNestedIntStructAlignmentInt64 extends Struct { external StructAlignmentInt64 a0; external StructAlignmentInt64 a1; @@ -923,7 +923,7 @@ class StructNestedIntStructAlignmentInt64 extends Struct { String toString() => "(${a0}, ${a1})"; } -class StructNestedIrregularBig extends Struct { +final class StructNestedIrregularBig extends Struct { @Uint16() external int a0; @@ -945,7 +945,7 @@ class StructNestedIrregularBig extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3}, ${a4}, ${a5}, ${a6})"; } -class StructNestedIrregularBigger extends Struct { +final class StructNestedIrregularBigger extends Struct { external StructNestedIrregularBig a0; external Struct8BytesNestedMixed a1; @@ -959,7 +959,7 @@ class StructNestedIrregularBigger extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3})"; } -class StructNestedIrregularEvenBigger extends Struct { +final class StructNestedIrregularEvenBigger extends Struct { @Uint64() external int a0; @@ -973,21 +973,21 @@ class StructNestedIrregularEvenBigger extends Struct { String toString() => "(${a0}, ${a1}, ${a2}, ${a3})"; } -class Struct8BytesInlineArrayInt extends Struct { +final class Struct8BytesInlineArrayInt extends Struct { @Array(8) external Array a0; String toString() => "(${[for (var i0 = 0; i0 < 8; i0 += 1) a0[i0]]})"; } -class Struct10BytesInlineArrayBool extends Struct { +final class Struct10BytesInlineArrayBool extends Struct { @Array(10) external Array a0; String toString() => "(${[for (var i0 = 0; i0 < 10; i0 += 1) a0[i0]]})"; } -class StructInlineArrayIrregular extends Struct { +final class StructInlineArrayIrregular extends Struct { @Array(2) external Array a0; @@ -997,14 +997,14 @@ class StructInlineArrayIrregular extends Struct { String toString() => "(${[for (var i0 = 0; i0 < 2; i0 += 1) a0[i0]]}, ${a1})"; } -class StructInlineArray100Bytes extends Struct { +final class StructInlineArray100Bytes extends Struct { @Array(100) external Array a0; String toString() => "(${[for (var i0 = 0; i0 < 100; i0 += 1) a0[i0]]})"; } -class StructInlineArrayBig extends Struct { +final class StructInlineArrayBig extends Struct { @Uint32() external int a0; @@ -1018,7 +1018,7 @@ class StructInlineArrayBig extends Struct { "(${a0}, ${a1}, ${[for (var i0 = 0; i0 < 4000; i0 += 1) a2[i0]]})"; } -class StructStruct16BytesHomogeneousFloat2 extends Struct { +final class StructStruct16BytesHomogeneousFloat2 extends Struct { external Struct4BytesFloat a0; @Array(2) @@ -1031,7 +1031,7 @@ class StructStruct16BytesHomogeneousFloat2 extends Struct { "(${a0}, ${[for (var i0 = 0; i0 < 2; i0 += 1) a1[i0]]}, ${a2})"; } -class StructStruct32BytesHomogeneousDouble2 extends Struct { +final class StructStruct32BytesHomogeneousDouble2 extends Struct { external Struct8BytesFloat a0; @Array(2) @@ -1044,7 +1044,7 @@ class StructStruct32BytesHomogeneousDouble2 extends Struct { "(${a0}, ${[for (var i0 = 0; i0 < 2; i0 += 1) a1[i0]]}, ${a2})"; } -class StructStruct16BytesMixed3 extends Struct { +final class StructStruct16BytesMixed3 extends Struct { external Struct4BytesFloat a0; @Array(1) @@ -1058,7 +1058,7 @@ class StructStruct16BytesMixed3 extends Struct { ]}, ${[for (var i0 = 0; i0 < 2; i0 += 1) a2[i0]]})"; } -class Struct8BytesInlineArrayMultiDimensionalInt extends Struct { +final class Struct8BytesInlineArrayMultiDimensionalInt extends Struct { @Array(2, 2, 2) external Array>> a0; @@ -1071,7 +1071,7 @@ class Struct8BytesInlineArrayMultiDimensionalInt extends Struct { ]})"; } -class Struct32BytesInlineArrayMultiDimensionalInt extends Struct { +final class Struct32BytesInlineArrayMultiDimensionalInt extends Struct { @Array(2, 2, 2, 2, 2) external Array>>>> a0; @@ -1090,7 +1090,7 @@ class Struct32BytesInlineArrayMultiDimensionalInt extends Struct { ]})"; } -class Struct64BytesInlineArrayMultiDimensionalInt extends Struct { +final class Struct64BytesInlineArrayMultiDimensionalInt extends Struct { @Array.multi([2, 2, 2, 2, 2, 2]) external Array>>>>> a0; @@ -1115,7 +1115,7 @@ class Struct64BytesInlineArrayMultiDimensionalInt extends Struct { ]})"; } -class Struct4BytesInlineArrayMultiDimensionalInt extends Struct { +final class Struct4BytesInlineArrayMultiDimensionalInt extends Struct { @Array(2, 2) external Array> a0; @@ -1126,7 +1126,7 @@ class Struct4BytesInlineArrayMultiDimensionalInt extends Struct { } @Packed(1) -class Struct3BytesPackedInt extends Struct { +final class Struct3BytesPackedInt extends Struct { @Int8() external int a0; @@ -1137,7 +1137,7 @@ class Struct3BytesPackedInt extends Struct { } @Packed(1) -class Struct3BytesPackedIntMembersAligned extends Struct { +final class Struct3BytesPackedIntMembersAligned extends Struct { @Int8() external int a0; @@ -1148,7 +1148,7 @@ class Struct3BytesPackedIntMembersAligned extends Struct { } @Packed(1) -class Struct5BytesPackedMixed extends Struct { +final class Struct5BytesPackedMixed extends Struct { @Float() external double a0; @@ -1158,7 +1158,7 @@ class Struct5BytesPackedMixed extends Struct { String toString() => "(${a0}, ${a1})"; } -class StructNestedAlignmentStruct5BytesPackedMixed extends Struct { +final class StructNestedAlignmentStruct5BytesPackedMixed extends Struct { @Uint8() external int a0; @@ -1167,7 +1167,7 @@ class StructNestedAlignmentStruct5BytesPackedMixed extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct6BytesInlineArrayInt extends Struct { +final class Struct6BytesInlineArrayInt extends Struct { @Array(2) external Array a0; @@ -1175,7 +1175,7 @@ class Struct6BytesInlineArrayInt extends Struct { } @Packed(1) -class Struct8BytesPackedInt extends Struct { +final class Struct8BytesPackedInt extends Struct { @Uint8() external int a0; @@ -1195,7 +1195,7 @@ class Struct8BytesPackedInt extends Struct { } @Packed(1) -class Struct9BytesPackedMixed extends Struct { +final class Struct9BytesPackedMixed extends Struct { @Uint8() external int a0; @@ -1205,14 +1205,14 @@ class Struct9BytesPackedMixed extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct15BytesInlineArrayMixed extends Struct { +final class Struct15BytesInlineArrayMixed extends Struct { @Array(3) external Array a0; String toString() => "(${[for (var i0 = 0; i0 < 3; i0 += 1) a0[i0]]})"; } -class Union4BytesMixed extends Union { +final class Union4BytesMixed extends Union { @Uint32() external int a0; @@ -1222,7 +1222,7 @@ class Union4BytesMixed extends Union { String toString() => "(${a0}, ${a1})"; } -class Union8BytesNestedFloat extends Union { +final class Union8BytesNestedFloat extends Union { @Double() external double a0; @@ -1231,7 +1231,7 @@ class Union8BytesNestedFloat extends Union { String toString() => "(${a0}, ${a1})"; } -class Union9BytesNestedInt extends Union { +final class Union9BytesNestedInt extends Union { external Struct8BytesInt a0; external Struct9BytesHomogeneousUint8 a1; @@ -1239,7 +1239,7 @@ class Union9BytesNestedInt extends Union { String toString() => "(${a0}, ${a1})"; } -class Union16BytesNestedInlineArrayFloat extends Union { +final class Union16BytesNestedInlineArrayFloat extends Union { @Array(4) external Array a0; @@ -1248,7 +1248,7 @@ class Union16BytesNestedInlineArrayFloat extends Union { String toString() => "(${[for (var i0 = 0; i0 < 4; i0 += 1) a0[i0]]}, ${a1})"; } -class Union16BytesNestedFloat extends Union { +final class Union16BytesNestedFloat extends Union { external Struct8BytesHomogeneousFloat a0; external Struct12BytesHomogeneousFloat a1; @@ -1258,7 +1258,7 @@ class Union16BytesNestedFloat extends Union { String toString() => "(${a0}, ${a1}, ${a2})"; } -class StructInlineArrayInt extends Struct { +final class StructInlineArrayInt extends Struct { @Array(10) external Array a0; diff --git a/tests/ffi/function_varargs_name_test.dart b/tests/ffi/function_varargs_name_test.dart index 308591f92b4..0064d4d1513 100644 --- a/tests/ffi/function_varargs_name_test.dart +++ b/tests/ffi/function_varargs_name_test.dart @@ -29,7 +29,7 @@ final variadicStructVarArgs = ffiTestFunctions.lookupFunction< ffi.Int64 Function(VarArgs, ffi.VarArgs<(VarArgs,)>), int Function(VarArgs, VarArgs)>('VariadicStructVarArgs'); -class VarArgs extends ffi.Struct { +final class VarArgs extends ffi.Struct { @ffi.Int32() external int a; } diff --git a/tests/ffi/native_effect_test.dart b/tests/ffi/native_effect_test.dart index 41d4aea831d..549ecdd581a 100644 --- a/tests/ffi/native_effect_test.dart +++ b/tests/ffi/native_effect_test.dart @@ -27,7 +27,7 @@ void testReturnStruct1ByteInt() { Expect.equals(1, result.a0); } -class Struct1ByteInt extends Struct { +final class Struct1ByteInt extends Struct { @Int8() external int a0; } diff --git a/tests/ffi/regress_43016_test.dart b/tests/ffi/regress_43016_test.dart index cbd68cca1b6..1aac740abd2 100644 --- a/tests/ffi/regress_43016_test.dart +++ b/tests/ffi/regress_43016_test.dart @@ -10,7 +10,7 @@ import 'dart:ffi'; import 'dylib_utils.dart'; -class MyStruct extends Struct { +final class MyStruct extends Struct { @Int8() external int a; } diff --git a/tests/ffi/regress_43693_test.dart b/tests/ffi/regress_43693_test.dart index 47e50152360..f32d933a505 100644 --- a/tests/ffi/regress_43693_test.dart +++ b/tests/ffi/regress_43693_test.dart @@ -11,7 +11,7 @@ import 'package:expect/expect.dart'; import 'dylib_utils.dart'; -class Struct43693 extends Struct { +final class Struct43693 extends Struct { external Pointer somePtr; @Uint64() diff --git a/tests/ffi/regress_44985_test.dart b/tests/ffi/regress_44985_test.dart index 6ef8da62c48..7a21a7a99c0 100644 --- a/tests/ffi/regress_44985_test.dart +++ b/tests/ffi/regress_44985_test.dart @@ -4,7 +4,7 @@ import "dart:ffi"; -class S2 extends Struct { +final class S2 extends Struct { external Pointer notEmpty; external Struct? s; //# 01: compile-time error diff --git a/tests/ffi/regress_44986_test.dart b/tests/ffi/regress_44986_test.dart index 2736deb92e3..f936aa95aaf 100644 --- a/tests/ffi/regress_44986_test.dart +++ b/tests/ffi/regress_44986_test.dart @@ -4,7 +4,7 @@ import "dart:ffi"; -class S2 extends Struct { +final class S2 extends Struct { external Pointer notEmpty; external Null s; //# 01: compile-time error diff --git a/tests/ffi/regress_45189_test.dart b/tests/ffi/regress_45189_test.dart index 980d1bcfa41..09e334c01ae 100644 --- a/tests/ffi/regress_45189_test.dart +++ b/tests/ffi/regress_45189_test.dart @@ -7,7 +7,7 @@ import "dart:ffi"; import "package:ffi/ffi.dart"; import 'package:expect/expect.dart'; -class Struct8BytesInlineArrayInt extends Struct { +final class Struct8BytesInlineArrayInt extends Struct { @Array(8) external Array a0; } diff --git a/tests/ffi/regress_45198_test.dart b/tests/ffi/regress_45198_test.dart index 3247d270902..2373d2c9454 100644 --- a/tests/ffi/regress_45198_test.dart +++ b/tests/ffi/regress_45198_test.dart @@ -7,7 +7,7 @@ import "dart:ffi"; import "package:expect/expect.dart"; import "package:ffi/ffi.dart"; -class Struct8BytesInlineArrayInt extends Struct { +final class Struct8BytesInlineArrayInt extends Struct { @Array(2) external Array> a0; } diff --git a/tests/ffi/regress_45507_test.dart b/tests/ffi/regress_45507_test.dart index 9f4655286d7..999d5bcf0f5 100644 --- a/tests/ffi/regress_45507_test.dart +++ b/tests/ffi/regress_45507_test.dart @@ -8,7 +8,7 @@ import "package:expect/expect.dart"; const EIGHT = 8; -class Struct8BytesInlineArrayInt extends Struct { +final class Struct8BytesInlineArrayInt extends Struct { @Array(EIGHT) external Array a0; } diff --git a/tests/ffi/regress_45988_test.dart b/tests/ffi/regress_45988_test.dart index ce58efb7e44..477b5c2d17a 100644 --- a/tests/ffi/regress_45988_test.dart +++ b/tests/ffi/regress_45988_test.dart @@ -7,7 +7,7 @@ import 'dart:ffi'; import "package:expect/expect.dart"; import "package:ffi/ffi.dart"; -class DartValueFields extends Union { +final class DartValueFields extends Union { external Pointer p1; external Pointer p2; external Pointer p3; diff --git a/tests/ffi/regress_46004_test.dart b/tests/ffi/regress_46004_test.dart index 81c4da706e5..e6366a8360c 100644 --- a/tests/ffi/regress_46004_test.dart +++ b/tests/ffi/regress_46004_test.dart @@ -7,7 +7,7 @@ import 'dart:ffi'; import "package:expect/expect.dart"; import "package:ffi/ffi.dart"; -class COMObject extends Struct { +final class COMObject extends Struct { external Pointer lpVtbl; // This should not be interpreted as a native field. diff --git a/tests/ffi/regress_46085_test.dart b/tests/ffi/regress_46085_test.dart index 5f681d66032..dedf73c45af 100644 --- a/tests/ffi/regress_46085_test.dart +++ b/tests/ffi/regress_46085_test.dart @@ -4,7 +4,7 @@ import "dart:ffi"; -class MyStruct extends Struct { +final class MyStruct extends Struct { external Pointer notEmpty; @Array.multi([]) //# 01: compile-time error diff --git a/tests/ffi/regress_46127_test.dart b/tests/ffi/regress_46127_test.dart index 4a60c5930bf..24052036cb9 100644 --- a/tests/ffi/regress_46127_test.dart +++ b/tests/ffi/regress_46127_test.dart @@ -12,7 +12,7 @@ import 'dylib_utils.dart'; final nativeLib = dlopenPlatformSpecific("ffi_test_functions"); -class Struct46127 extends Struct { +final class Struct46127 extends Struct { @Uint64() external int val; } diff --git a/tests/ffi/regress_47673_2_test.dart b/tests/ffi/regress_47673_2_test.dart index 90485218f43..b3391e5db2f 100644 --- a/tests/ffi/regress_47673_2_test.dart +++ b/tests/ffi/regress_47673_2_test.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; -class A extends Struct { +final class A extends Struct { @Array.multi([16]) external Array a; diff --git a/tests/ffi/regress_47673_test.dart b/tests/ffi/regress_47673_test.dart index b372e0931b8..f731b99e926 100644 --- a/tests/ffi/regress_47673_test.dart +++ b/tests/ffi/regress_47673_test.dart @@ -8,7 +8,7 @@ import 'dart:ffi'; typedef T = Int64; -class A extends Struct { +final class A extends Struct { @Array.multi([16]) external Array b; } diff --git a/tests/ffi/regress_51041_test.dart b/tests/ffi/regress_51041_test.dart index 487a97e9655..189a1ca496f 100644 --- a/tests/ffi/regress_51041_test.dart +++ b/tests/ffi/regress_51041_test.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; -class Foo extends Struct { +final class Foo extends Struct { @Int32() external int // Force `?` to newline. ? //# 1: compile-time error diff --git a/tests/ffi/regress_51315_test.dart b/tests/ffi/regress_51315_test.dart index 81a3f7a0138..3adc5ef61fa 100644 --- a/tests/ffi/regress_51315_test.dart +++ b/tests/ffi/regress_51315_test.dart @@ -30,7 +30,7 @@ testCompoundLoadAndStore() { calloc.free(foos); } -class Foo extends Struct { +final class Foo extends Struct { @Int8() external int a; } diff --git a/tests/ffi/regress_51321_test.dart b/tests/ffi/regress_51321_test.dart index 3e6a454badf..23691855a31 100644 --- a/tests/ffi/regress_51321_test.dart +++ b/tests/ffi/regress_51321_test.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; -class Foo extends Struct { +final class Foo extends Struct { @IntPtr() external int bar; } diff --git a/tests/ffi/regress_jump_to_frame_test.dart b/tests/ffi/regress_jump_to_frame_test.dart index c834253e692..7affa08f33c 100644 --- a/tests/ffi/regress_jump_to_frame_test.dart +++ b/tests/ffi/regress_jump_to_frame_test.dart @@ -50,12 +50,12 @@ final Dart_PropagateError_DartType propagateError = () { throw 'Not found'; }(); -class _DartEntry extends Struct { +final class _DartEntry extends Struct { external Pointer name; external Pointer function; } -class _DartApi extends Struct { +final class _DartApi extends Struct { @Int32() external int major; @Int32() diff --git a/tests/ffi/structs_nested_test.dart b/tests/ffi/structs_nested_test.dart index 313b8c48c38..ee516f26d40 100644 --- a/tests/ffi/structs_nested_test.dart +++ b/tests/ffi/structs_nested_test.dart @@ -24,7 +24,7 @@ void main() { } } -class Struct4BytesHomogeneousInt16 extends Struct { +final class Struct4BytesHomogeneousInt16 extends Struct { @Int16() external int a0; @@ -34,7 +34,7 @@ class Struct4BytesHomogeneousInt16 extends Struct { String toString() => "(${a0}, ${a1})"; } -class Struct8BytesNestedInt extends Struct { +final class Struct8BytesNestedInt extends Struct { external Struct4BytesHomogeneousInt16 a0; external Struct4BytesHomogeneousInt16 a1; diff --git a/tests/ffi/very_large_struct.dart b/tests/ffi/very_large_struct.dart index d827e4aeac5..cdd9c80cd39 100644 --- a/tests/ffi/very_large_struct.dart +++ b/tests/ffi/very_large_struct.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; /// Large sample struct for dart:ffi library. -class VeryLargeStruct extends Struct { +final class VeryLargeStruct extends Struct { @Int8() external int a; diff --git a/tests/ffi/vmspecific_regress_37100_test.dart b/tests/ffi/vmspecific_regress_37100_test.dart index ef4c6149d72..86eb72bc890 100644 --- a/tests/ffi/vmspecific_regress_37100_test.dart +++ b/tests/ffi/vmspecific_regress_37100_test.dart @@ -10,7 +10,7 @@ import "package:expect/expect.dart"; import 'dylib_utils.dart'; -class EVP_MD extends Opaque {} +final class EVP_MD extends Opaque {} DynamicLibrary ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions"); diff --git a/tests/ffi/vmspecific_regress_38993_test.dart b/tests/ffi/vmspecific_regress_38993_test.dart index 4391b007ffc..0582a9b51f8 100644 --- a/tests/ffi/vmspecific_regress_38993_test.dart +++ b/tests/ffi/vmspecific_regress_38993_test.dart @@ -6,7 +6,7 @@ import "dart:ffi"; -class C extends Struct { +final class C extends Struct { dynamic x; //# 1: compile-time error external Pointer notEmpty; diff --git a/tests/ffi/vmspecific_static_checks_test.dart b/tests/ffi/vmspecific_static_checks_test.dart index 378264db7aa..c9525533201 100644 --- a/tests/ffi/vmspecific_static_checks_test.dart +++ b/tests/ffi/vmspecific_static_checks_test.dart @@ -330,7 +330,7 @@ void testLookupFunctionPointerNFdyn() { } // error on missing field annotation -class TestStruct extends Struct { +final class TestStruct extends Struct { @Double() external double x; @@ -341,14 +341,14 @@ class TestStruct extends Struct { class TestStruct3 extends TestStruct {} //# 52: compile-time error // error on double annotation -class TestStruct4 extends Struct { +final class TestStruct4 extends Struct { @Double() @Double() //# 53: compile-time error external double z; } // error on annotation not matching up -class TestStruct5 extends Struct { +final class TestStruct5 extends Struct { @Int64() //# 54: compile-time error external double z; //# 54: compile-time error @@ -356,7 +356,7 @@ class TestStruct5 extends Struct { } // error on annotation not matching up -class TestStruct6 extends Struct { +final class TestStruct6 extends Struct { @Void() //# 55: compile-time error external double z; //# 55: compile-time error @@ -364,7 +364,7 @@ class TestStruct6 extends Struct { } // error on annotation not matching up -class TestStruct7 extends Struct { +final class TestStruct7 extends Struct { @NativeType() //# 56: compile-time error external double z; //# 56: compile-time error @@ -372,7 +372,7 @@ class TestStruct7 extends Struct { } // error on field initializer on field -class TestStruct8 extends Struct { +final class TestStruct8 extends Struct { @Double() //# 57: compile-time error double z = 10.0; //# 57: compile-time error @@ -380,7 +380,7 @@ class TestStruct8 extends Struct { } // error on field initializer in constructor -class TestStruct9 extends Struct { +final class TestStruct9 extends Struct { @Double() //# 58: compile-time error double z; //# 58: compile-time error @@ -395,7 +395,7 @@ class TestStruct11 extends //# 60: compile-time error // Structs may not appear inside structs (currently, there is no suitable // annotation). -class TestStruct12 extends Struct { +final class TestStruct12 extends Struct { @Pointer //# 61: compile-time error external TestStruct9 struct; //# 61: compile-time error @@ -407,7 +407,7 @@ class DummyAnnotation { } // Structs fields may have other annotations. -class TestStruct13 extends Struct { +final class TestStruct13 extends Struct { @DummyAnnotation() @Double() external double z; @@ -504,22 +504,22 @@ void testHandleVariance() { MyClass Function(Object)>("PassObjectToC"); //# 1000: compile-time error } -class TestStruct1001 extends Struct { +final class TestStruct1001 extends Struct { external Handle handle; //# 1001: compile-time error external Pointer notEmpty; } -class TestStruct1002 extends Struct { +final class TestStruct1002 extends Struct { @Handle() //# 1002: compile-time error external Object handle; //# 1002: compile-time error external Pointer notEmpty; } -class EmptyStruct extends Struct {} //# 1099: compile-time error +final class EmptyStruct extends Struct {} //# 1099: compile-time error -class EmptyStruct extends Struct {} //# 1100: compile-time error +final class EmptyStruct extends Struct {} //# 1100: compile-time error void testEmptyStructLookupFunctionArgument() { testLibrary.lookupFunction< //# 1100: compile-time error @@ -527,7 +527,7 @@ void testEmptyStructLookupFunctionArgument() { void Function(EmptyStruct)>("DoesNotExist"); //# 1100: compile-time error } -class EmptyStruct extends Struct {} //# 1101: compile-time error +final class EmptyStruct extends Struct {} //# 1101: compile-time error void testEmptyStructLookupFunctionReturn() { testLibrary.lookupFunction< //# 1101: compile-time error @@ -535,7 +535,7 @@ void testEmptyStructLookupFunctionReturn() { EmptyStruct Function()>("DoesNotExist"); //# 1101: compile-time error } -class EmptyStruct extends Struct {} //# 1102: compile-time error +final class EmptyStruct extends Struct {} //# 1102: compile-time error void testEmptyStructAsFunctionArgument() { final Pointer< //# 1102: compile-time error @@ -545,7 +545,7 @@ void testEmptyStructAsFunctionArgument() { pointer.asFunction(); //# 1102: compile-time error } -class EmptyStruct extends Struct {} //# 1103: compile-time error +final class EmptyStruct extends Struct {} //# 1103: compile-time error void testEmptyStructAsFunctionReturn() { final Pointer< //# 1103: compile-time error @@ -554,7 +554,7 @@ void testEmptyStructAsFunctionReturn() { pointer.asFunction(); //# 1103: compile-time error } -class EmptyStruct extends Struct {} //# 1104: compile-time error +final class EmptyStruct extends Struct {} //# 1104: compile-time error void _consumeEmptyStruct(EmptyStruct e) => //# 1104: compile-time error print(e); //# 1104: compile-time error @@ -564,7 +564,7 @@ void testEmptyStructFromFunctionArgument() { _consumeEmptyStruct); //# 1104: compile-time error } -class EmptyStruct extends Struct {} //# 1105: compile-time error +final class EmptyStruct extends Struct {} //# 1105: compile-time error EmptyStruct _returnEmptyStruct() => EmptyStruct(); //# 1105: compile-time error @@ -573,9 +573,9 @@ void testEmptyStructFromFunctionReturn() { _returnEmptyStruct); //# 1105: compile-time error } -class EmptyStruct extends Struct {} //# 1106: compile-time error +final class EmptyStruct extends Struct {} //# 1106: compile-time error -class HasNestedEmptyStruct extends Struct { +final class HasNestedEmptyStruct extends Struct { external EmptyStruct nestedEmptyStruct; //# 1106: compile-time error external Pointer notEmpty; @@ -653,40 +653,40 @@ void testElementAtNativeType() { calloc.free(p); } -class TestStruct1400 extends Struct { +final class TestStruct1400 extends Struct { @Array(8) //# 1400: compile-time error @Array(8) external Array a0; } -class TestStruct1401 extends Struct { +final class TestStruct1401 extends Struct { external Array a0; //# 1401: compile-time error external Pointer notEmpty; } -class TestStruct1402 extends Struct { +final class TestStruct1402 extends Struct { @Array(8, 8, 8) //# 1402: compile-time error external Array> a0; //# 1402: compile-time error external Pointer notEmpty; } -class TestStruct1403 extends Struct { +final class TestStruct1403 extends Struct { @Array(8, 8) //# 1403: compile-time error external Array>> a0; //# 1403: compile-time error external Pointer notEmpty; } -class TestStruct1404 extends Struct { +final class TestStruct1404 extends Struct { @Array.multi([8, 8, 8]) //# 1404: compile-time error external Array> a0; //# 1404: compile-time error external Pointer notEmpty; } -class TestStruct1405 extends Struct { +final class TestStruct1405 extends Struct { @Array.multi([8, 8]) //# 1405: compile-time error external Array>> a0; //# 1405: compile-time error @@ -743,41 +743,41 @@ void testAsFunctionReturnsHandle() { } @Packed(1) -class TestStruct1600 extends Struct { +final class TestStruct1600 extends Struct { external Pointer notEmpty; } @Packed(1) @Packed(1) //# 1601: compile-time error -class TestStruct1601 extends Struct { +final class TestStruct1601 extends Struct { external Pointer notEmpty; } @Packed(3) //# 1602: compile-time error -class TestStruct1602 extends Struct { +final class TestStruct1602 extends Struct { external Pointer notEmpty; } @Packed(0) //# 1607: compile-time error -class TestStruct1607 extends Struct { +final class TestStruct1607 extends Struct { external Pointer notEmpty; } -class TestStruct1800 extends Struct { +final class TestStruct1800 extends Struct { external Pointer notEmpty; @Array(-1) //# 1800: compile-time error external Array inlineArray; //# 1800: compile-time error } -class TestStruct1801 extends Struct { +final class TestStruct1801 extends Struct { external Pointer notEmpty; @Array(1, -1) //# 1801: compile-time error external Array inlineArray; //# 1801: compile-time error } -class TestStruct1802 extends Struct { +final class TestStruct1802 extends Struct { external Pointer notEmpty; @Array.multi([2, 2, 2, 2, 2, 2, -1]) //# 1802: compile-time error @@ -790,7 +790,7 @@ class TestStruct1802 extends Struct { Abi.androidIA32: AbiSpecificInteger1(), //# 1901: compile-time error }) @AbiSpecificIntegerMapping({}) //# 1902: compile-time error -class AbiSpecificInteger1 extends AbiSpecificInteger { +final class AbiSpecificInteger1 extends AbiSpecificInteger { const AbiSpecificInteger1(); int get a => 4; //# 1910: compile-time error @@ -816,7 +816,7 @@ class AbiSpecificInteger4 const AbiSpecificInteger4(); } -class MyFinalizableStruct extends Struct +final class MyFinalizableStruct extends Struct implements Finalizable //# 2000: compile-time error { external Pointer field; diff --git a/tests/standalone/io/socket_sigpipe_test.dart b/tests/standalone/io/socket_sigpipe_test.dart index ec6f5c85d20..4473ecf23c8 100644 --- a/tests/standalone/io/socket_sigpipe_test.dart +++ b/tests/standalone/io/socket_sigpipe_test.dart @@ -16,7 +16,7 @@ import 'package:path/path.dart' as p; import '../../../tests/ffi/dylib_utils.dart'; -class Isolate extends Opaque {} +final class Isolate extends Opaque {} abstract class FfiBindings { static final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions"); diff --git a/tests/standalone_2/io/socket_sigpipe_test.dart b/tests/standalone_2/io/socket_sigpipe_test.dart index ec6f5c85d20..f8778e7d255 100644 --- a/tests/standalone_2/io/socket_sigpipe_test.dart +++ b/tests/standalone_2/io/socket_sigpipe_test.dart @@ -4,6 +4,8 @@ // // Tests that SIGPIPE won't terminate websocket client dart app. +// @dart = 2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:ffi'; diff --git a/tests/web/wasm/ffi_native_test.dart b/tests/web/wasm/ffi_native_test.dart index 9703f419ed0..f3efb95405f 100644 --- a/tests/web/wasm/ffi_native_test.dart +++ b/tests/web/wasm/ffi_native_test.dart @@ -93,7 +93,7 @@ external int incrementSize(int a); @Native() external int incrementWchar(int a); -class MyStruct extends Struct implements NativeFieldWrapperClass1 { +final class MyStruct extends Struct implements NativeFieldWrapperClass1 { @Double() external double x; diff --git a/tools/verify_docs/bin/verify_docs.dart b/tools/verify_docs/bin/verify_docs.dart index 29ed25e20b2..73e6d9ea6e9 100755 --- a/tools/verify_docs/bin/verify_docs.dart +++ b/tools/verify_docs/bin/verify_docs.dart @@ -239,7 +239,7 @@ class ValidateCommentCodeSamplesVisitor extends GeneralizingAstVisitor { final _toplevelDeclarationRE = RegExp(r'^\s*(?:' r'library\b(?)|' r'''import (['"])(?.*?)\2|''' - r'class\b|mixin\b|enum\b|extension\b|typedef\b|.*\bmain\(' + r'final class\b|class\b|mixin\b|enum\b|extension\b|typedef\b|.*\bmain\(' r')'); validateCodeSample(CodeSample sample) async {