diff --git a/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart b/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart index c0deefae39f..1420d127647 100644 --- a/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart +++ b/pkg/analyzer/test/src/diagnostics/ffi_leaf_call_must_not_use_handle_test.dart @@ -50,14 +50,14 @@ doThings() { await assertErrorsInCode(r''' import 'dart:ffi'; -class NativeFieldWrapperClass1 {} +base class NativeFieldWrapperClass1 {} -class A extends NativeFieldWrapperClass1 { +base class A extends NativeFieldWrapperClass1 { @FfiNative)>('foo', isLeaf:true) external Object get foo; } ''', [ - error(FfiCode.LEAF_CALL_MUST_NOT_RETURN_HANDLE, 100, 89), + error(FfiCode.LEAF_CALL_MUST_NOT_RETURN_HANDLE, 110, 89), ]); } diff --git a/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart b/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart index 79cf773ea97..91c04f79e04 100644 --- a/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart +++ b/pkg/analyzer/test/src/diagnostics/ffi_native_test.dart @@ -21,9 +21,9 @@ class FfiNativeTest extends PubPackageResolutionTest { await assertErrorsInCode(r''' import 'dart:ffi'; -class NativeFieldWrapperClass1 {} +base class NativeFieldWrapperClass1 {} -class Paragraph extends NativeFieldWrapperClass1 { +base class Paragraph extends NativeFieldWrapperClass1 { @FfiNative)>('Paragraph::ideographicBaseline', isLeaf: true) external double get ideographicBaseline; @@ -190,9 +190,9 @@ class NativeTest extends PubPackageResolutionTest { await assertNoErrorsInCode(r''' import 'dart:ffi'; -class NativeFieldWrapperClass1 {} +base class NativeFieldWrapperClass1 {} -class Paragraph extends NativeFieldWrapperClass1 { +base class Paragraph extends NativeFieldWrapperClass1 { @Native)>(isLeaf: true) external double get ideographicBaseline; diff --git a/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart b/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart index 955c5b230b0..0809c7fff10 100644 --- a/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart +++ b/runtime/tests/vm/dart/isolates/fast_object_copy_test.dart @@ -26,7 +26,7 @@ import 'dart:typed_data'; import 'package:expect/expect.dart'; -class ClassWithNativeFields extends NativeFieldWrapperClass1 { +base class ClassWithNativeFields extends NativeFieldWrapperClass1 { void m() {} } diff --git a/runtime/tests/vm/dart/isolates/send_unsupported_objects_test.dart b/runtime/tests/vm/dart/isolates/send_unsupported_objects_test.dart index d286460d4aa..8890b8a08ad 100644 --- a/runtime/tests/vm/dart/isolates/send_unsupported_objects_test.dart +++ b/runtime/tests/vm/dart/isolates/send_unsupported_objects_test.dart @@ -20,7 +20,7 @@ class Bar { Foo foo = Foo(); } -class NativeClass extends NativeFieldWrapperClass1 {} +base class NativeClass extends NativeFieldWrapperClass1 {} class Baz { @pragma('vm:entry-point') // prevent tree-shaking of the field. diff --git a/runtime/tests/vm/dart/sendandexit_test.dart b/runtime/tests/vm/dart/sendandexit_test.dart index bbcb3b076ad..8c00a9c8f59 100644 --- a/runtime/tests/vm/dart/sendandexit_test.dart +++ b/runtime/tests/vm/dart/sendandexit_test.dart @@ -26,7 +26,7 @@ spawnWorker(worker, data) async { return await completer.future; } -class NativeWrapperClass extends NativeFieldWrapperClass1 {} +base class NativeWrapperClass extends NativeFieldWrapperClass1 {} verifyCantSendNative() async { final receivePort = ReceivePort(); diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc index f6bce67f332..e99ebd14f82 100644 --- a/runtime/vm/benchmark_test.cc +++ b/runtime/vm/benchmark_test.cc @@ -168,7 +168,7 @@ BENCHMARK(UseDartApi) { const char* kScriptChars = R"( import 'dart:nativewrappers'; -class Class extends NativeFieldWrapperClass1 { +base class Class extends NativeFieldWrapperClass1 { @pragma("vm:external-name", "init") external void init(); @pragma("vm:external-name", "method") diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc index 2c7c6023070..6df4c750e48 100644 --- a/runtime/vm/dart_api_impl_test.cc +++ b/runtime/vm/dart_api_impl_test.cc @@ -4601,7 +4601,7 @@ void FUNCTION_NAME(ExampleResource_Dispose)(Dart_NativeArguments native_args) { TEST_CASE(DartAPI_WeakPersistentHandleUpdateSize) { const char* kScriptChars = R"( import "dart:nativewrappers"; - class ExampleResource extends NativeFieldWrapperClass1 { + base class ExampleResource extends NativeFieldWrapperClass1 { ExampleResource() { _allocate(); } @pragma("vm:external-name", "ExampleResource_Allocate") external void _allocate(); @@ -4660,7 +4660,7 @@ TEST_CASE(DartAPI_NativeFieldAccess) { const char* kScriptChars = R"( import 'dart:ffi'; import 'dart:nativewrappers'; - class SecretKeeper extends NativeFieldWrapperClass1 { + base class SecretKeeper extends NativeFieldWrapperClass1 { SecretKeeper(int secret) { _keepSecret(secret); } @pragma("vm:external-name", "SecretKeeper_KeepSecret") external void _keepSecret(int secret); @@ -4694,7 +4694,7 @@ TEST_CASE(DartAPI_NativeFieldAccess_Throws) { const char* kScriptChars = R"( import 'dart:ffi'; import 'dart:nativewrappers'; - class ForgetfulSecretKeeper extends NativeFieldWrapperClass1 { + base class ForgetfulSecretKeeper extends NativeFieldWrapperClass1 { ForgetfulSecretKeeper(int secret) { /* Forget to init. native field. */ } } // Argument auto-conversion will wrap `o` in `_getNativeField()`. @@ -5699,7 +5699,8 @@ TEST_CASE(DartAPI_InjectNativeFields3) { auto kScriptChars = Utils::CStringUniquePtr( OS::SCreate(nullptr, "import 'dart:nativewrappers';" - "class NativeFields extends NativeFieldWrapperClass2 {\n" + "final class NativeFields " + "extends NativeFieldWrapperClass2 {\n" " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n" " int fld1;\n" " final int fld2;\n" @@ -5843,7 +5844,7 @@ TEST_CASE(DartAPI_TestNativeFieldsAccess) { OS::SCreate( nullptr, R"( import 'dart:nativewrappers'; - class NativeFields extends NativeFieldWrapperClass2 { + base class NativeFields extends NativeFieldWrapperClass2 { NativeFields(int i, int j) : fld1 = i, fld2 = j {} int fld1; final int fld2; @@ -5883,11 +5884,11 @@ TEST_CASE(DartAPI_TestNativeFieldsAccess) { TEST_CASE(DartAPI_InjectNativeFieldsSuperClass) { const char* kScriptChars = "import 'dart:nativewrappers';" - "class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n" + "base class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n" " NativeFieldsSuper() : fld1 = 42 {}\n" " int fld1;\n" "}\n" - "class NativeFields extends NativeFieldsSuper {\n" + "base class NativeFields extends NativeFieldsSuper {\n" " fld() => fld1;\n" "}\n" "int testMain() {\n" @@ -5990,7 +5991,8 @@ TEST_CASE(DartAPI_ImplicitNativeFieldAccess) { auto kScriptChars = Utils::CStringUniquePtr( OS::SCreate(nullptr, "import 'dart:nativewrappers';" - "class NativeFields extends NativeFieldWrapperClass4 {\n" + "final class NativeFields extends " + "NativeFieldWrapperClass4 {\n" " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n" " int%s fld0;\n" " int fld1;\n" @@ -7424,7 +7426,7 @@ static Dart_NativeFunction native_args_lookup(Dart_Handle name, TEST_CASE(DartAPI_GetNativeArguments) { const char* kScriptChars = R"( import 'dart:nativewrappers'; -class MyObject extends NativeFieldWrapperClass2 { +base class MyObject extends NativeFieldWrapperClass2 { @pragma("vm:external-name", "NativeArgument_Create") external static MyObject createObject(); @pragma("vm:external-name", "NativeArgument_Access") diff --git a/sdk/lib/_internal/vm/bin/directory_patch.dart b/sdk/lib/_internal/vm/bin/directory_patch.dart index bf4b6ef7786..e0efabc10ea 100644 --- a/sdk/lib/_internal/vm/bin/directory_patch.dart +++ b/sdk/lib/_internal/vm/bin/directory_patch.dart @@ -49,7 +49,7 @@ class _AsyncDirectoryListerOps { new _AsyncDirectoryListerOpsImpl(pointer); } -class _AsyncDirectoryListerOpsImpl extends NativeFieldWrapperClass1 +base class _AsyncDirectoryListerOpsImpl extends NativeFieldWrapperClass1 implements _AsyncDirectoryListerOps { _AsyncDirectoryListerOpsImpl._(); diff --git a/sdk/lib/_internal/vm/bin/file_patch.dart b/sdk/lib/_internal/vm/bin/file_patch.dart index 00d3ef8e4d2..383e95bf5e8 100644 --- a/sdk/lib/_internal/vm/bin/file_patch.dart +++ b/sdk/lib/_internal/vm/bin/file_patch.dart @@ -74,7 +74,7 @@ class _RandomAccessFileOps { } @pragma("vm:entry-point") -class _RandomAccessFileOpsImpl extends NativeFieldWrapperClass1 +base class _RandomAccessFileOpsImpl extends NativeFieldWrapperClass1 implements _RandomAccessFileOps { _RandomAccessFileOpsImpl._(); diff --git a/sdk/lib/_internal/vm/bin/filter_patch.dart b/sdk/lib/_internal/vm/bin/filter_patch.dart index 79ed27d1edf..12eaee7232b 100644 --- a/sdk/lib/_internal/vm/bin/filter_patch.dart +++ b/sdk/lib/_internal/vm/bin/filter_patch.dart @@ -4,7 +4,8 @@ part of "common_patch.dart"; -class _FilterImpl extends NativeFieldWrapperClass1 implements RawZLibFilter { +base class _FilterImpl extends NativeFieldWrapperClass1 + implements RawZLibFilter { @pragma("vm:external-name", "Filter_Process") external void process(List data, int start, int end); @@ -12,7 +13,7 @@ class _FilterImpl extends NativeFieldWrapperClass1 implements RawZLibFilter { external List? processed({bool flush = true, bool end = false}); } -class _ZLibInflateFilter extends _FilterImpl { +base class _ZLibInflateFilter extends _FilterImpl { _ZLibInflateFilter(int windowBits, List? dictionary, bool raw) { _init(windowBits, dictionary, raw); } @@ -20,7 +21,7 @@ class _ZLibInflateFilter extends _FilterImpl { external void _init(int windowBits, List? dictionary, bool raw); } -class _ZLibDeflateFilter extends _FilterImpl { +base class _ZLibDeflateFilter extends _FilterImpl { _ZLibDeflateFilter(bool gzip, int level, int windowBits, int memLevel, int strategy, List? dictionary, bool raw) { _init(gzip, level, windowBits, memLevel, strategy, dictionary, raw); diff --git a/sdk/lib/_internal/vm/bin/namespace_patch.dart b/sdk/lib/_internal/vm/bin/namespace_patch.dart index 97065dbced8..cf8b43aaf6f 100644 --- a/sdk/lib/_internal/vm/bin/namespace_patch.dart +++ b/sdk/lib/_internal/vm/bin/namespace_patch.dart @@ -5,7 +5,8 @@ part of 'common_patch.dart'; @pragma("vm:entry-point") -class _NamespaceImpl extends NativeFieldWrapperClass1 implements _Namespace { +base class _NamespaceImpl extends NativeFieldWrapperClass1 + implements _Namespace { _NamespaceImpl._(); @pragma("vm:external-name", "Namespace_Create") diff --git a/sdk/lib/_internal/vm/bin/process_patch.dart b/sdk/lib/_internal/vm/bin/process_patch.dart index 9dbd12da03a..196a44f5faf 100644 --- a/sdk/lib/_internal/vm/bin/process_patch.dart +++ b/sdk/lib/_internal/vm/bin/process_patch.dart @@ -213,9 +213,9 @@ class _ProcessStartStatus { // The NativeFieldWrapperClass1 can not be used with a mixin, due to missing // implicit constructor. -class _ProcessImplNativeWrapper extends NativeFieldWrapperClass1 {} +base class _ProcessImplNativeWrapper extends NativeFieldWrapperClass1 {} -class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process { +base class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process { static bool connectedResourceHandler = false; _ProcessImpl( diff --git a/sdk/lib/_internal/vm/bin/secure_socket_patch.dart b/sdk/lib/_internal/vm/bin/secure_socket_patch.dart index 9f6641dcd94..2a40fc4206a 100644 --- a/sdk/lib/_internal/vm/bin/secure_socket_patch.dart +++ b/sdk/lib/_internal/vm/bin/secure_socket_patch.dart @@ -60,7 +60,7 @@ class _SecureSocket extends _Socket implements SecureSocket { * native code can access the same data. */ @pragma("vm:entry-point") -class _SecureFilterImpl extends NativeFieldWrapperClass1 +base class _SecureFilterImpl extends NativeFieldWrapperClass1 implements _SecureFilter { // Performance is improved if a full buffer of plaintext fits // in the encrypted buffer, when encrypted. @@ -208,7 +208,7 @@ class SecurityContext { static bool get alpnSupported => true; } -class _SecurityContext extends NativeFieldWrapperClass1 +base class _SecurityContext extends NativeFieldWrapperClass1 implements SecurityContext { bool _allowLegacyUnsafeRenegotiation = false; @@ -284,7 +284,7 @@ class _SecurityContext extends NativeFieldWrapperClass1 * _X509CertificateImpl wraps an X509 certificate object held by the BoringSSL * library. It exposes the fields of the certificate object. */ -class _X509CertificateImpl extends NativeFieldWrapperClass1 +base class _X509CertificateImpl extends NativeFieldWrapperClass1 implements X509Certificate { // The native field must be set manually on a new object, in native code. // This is done by WrappedX509Certificate in security_context.cc. diff --git a/sdk/lib/_internal/vm/bin/socket_patch.dart b/sdk/lib/_internal/vm/bin/socket_patch.dart index 5ae91a1b41a..e28bb75d646 100644 --- a/sdk/lib/_internal/vm/bin/socket_patch.dart +++ b/sdk/lib/_internal/vm/bin/socket_patch.dart @@ -370,14 +370,15 @@ class _NetworkInterface implements NetworkInterface { // The NativeFieldWrapperClass1 cannot be used with a mixin, due to missing // implicit constructor. -class _NativeSocketNativeWrapper extends NativeFieldWrapperClass1 {} +base class _NativeSocketNativeWrapper extends NativeFieldWrapperClass1 {} /// Returns error code that corresponds to EINPROGRESS OS error. @pragma("vm:external-name", "OSError_inProgressErrorCode") external int get _inProgressErrorCode; // The _NativeSocket class encapsulates an OS socket. -class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject { +base class _NativeSocket extends _NativeSocketNativeWrapper + with _ServiceObject { // Bit flags used when communicating between the eventhandler and // dart code. The EVENT flags are used to indicate events of // interest when sending a message from dart code to the diff --git a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart index 16fd08aff4b..bb0193969f8 100644 --- a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart +++ b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart @@ -45,10 +45,12 @@ class _RawSynchronousSocket implements RawSynchronousSocket { // The NativeFieldWrapperClass1 can not be used with a mixin, due to missing // implicit constructor. -class _NativeSynchronousSocketNativeWrapper extends NativeFieldWrapperClass1 {} +base class _NativeSynchronousSocketNativeWrapper + extends NativeFieldWrapperClass1 {} // The _NativeSynchronousSocket class encapsulates a synchronous OS socket. -class _NativeSynchronousSocket extends _NativeSynchronousSocketNativeWrapper { +base class _NativeSynchronousSocket + extends _NativeSynchronousSocketNativeWrapper { // Socket close state. bool isClosed = false; bool isClosedRead = false; diff --git a/tests/ffi/ffi_native_test.dart b/tests/ffi/ffi_native_test.dart index 808c70c89f8..99a22fee74d 100644 --- a/tests/ffi/ffi_native_test.dart +++ b/tests/ffi/ffi_native_test.dart @@ -16,7 +16,7 @@ class Classy { external void goodHasReceiverHandle(int v); } -class NativeClassy extends NativeFieldWrapperClass1 { +base class NativeClassy extends NativeFieldWrapperClass1 { @FfiNative('ReturnIntPtr') external static int returnIntPtrStatic(int x); diff --git a/tests/ffi/vmspecific_ffi_native_test.dart b/tests/ffi/vmspecific_ffi_native_test.dart index d8115eef4af..177192be9cc 100644 --- a/tests/ffi/vmspecific_ffi_native_test.dart +++ b/tests/ffi/vmspecific_ffi_native_test.dart @@ -48,7 +48,7 @@ class Classy { // For automatic transform of NativeFieldWrapperClass1 to Pointer. -class ClassWithNativeField extends NativeFieldWrapperClass1 { +base class ClassWithNativeField extends NativeFieldWrapperClass1 { ClassWithNativeField(int value) { setNativeInstanceField(this, 0, value); } @@ -105,7 +105,7 @@ int setState(int value) { return 0; } -class StateSetter extends NativeFieldWrapperClass1 { +base class StateSetter extends NativeFieldWrapperClass1 { StateSetter(int value) { setNativeInstanceField(this, 0, 0); state = value; diff --git a/tests/ffi/vmspecific_static_checks_ffinative_test.dart b/tests/ffi/vmspecific_static_checks_ffinative_test.dart index 8038c09545c..0c207b26725 100644 --- a/tests/ffi/vmspecific_static_checks_ffinative_test.dart +++ b/tests/ffi/vmspecific_static_checks_ffinative_test.dart @@ -33,7 +33,7 @@ class Classy { external void badHasReceiverPointer(int v); //# 04: compile-time error } -class NativeClassy extends NativeFieldWrapperClass1 { +base class NativeClassy extends NativeFieldWrapperClass1 { // Error: Missing receiver in FfiNative annotation. @FfiNative('doesntmatter') //# 05: compile-time error external void badMissingReceiver(int v); //# 05: compile-time error diff --git a/tests/lib/isolate/native_wrapper_message_test.dart b/tests/lib/isolate/native_wrapper_message_test.dart index fc901041bfb..24b7d005757 100644 --- a/tests/lib/isolate/native_wrapper_message_test.dart +++ b/tests/lib/isolate/native_wrapper_message_test.dart @@ -13,7 +13,7 @@ echo(msg) { reply.send('echoing ${data(1)}}'); } -class Test extends NativeFieldWrapperClass2 { +base class Test extends NativeFieldWrapperClass2 { Test(this.i, this.j); int i, j; } diff --git a/tests/web/wasm/ffi_native_test.dart b/tests/web/wasm/ffi_native_test.dart index f3efb95405f..6a31195c2a2 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); -final class MyStruct extends Struct implements NativeFieldWrapperClass1 { +final class MyStruct extends Struct { @Double() external double x;