From 6bc49bb7c31cd68ceee86d602bef864ac876d65d Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 6 Oct 2025 06:29:52 -0700 Subject: [PATCH] SDK: Deprecate the ability to implement RegExp and RegExpMatch. Work towards https://github.com/dart-lang/sdk/issues/55608 Change-Id: Ib686c5a070c54907e9f4d900cd0736ca70a712d0 CoreLibraryReviewExempt: No behavioral change Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453460 Reviewed-by: Lasse Nielsen Commit-Queue: Samuel Rawlins --- CHANGELOG.md | 2 ++ sdk/lib/core/regexp.dart | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f01255480f..df16cbc3f5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,8 @@ instead. deprecated. - [`@Deprecated.instantiate()`][] indicates the ability to instantiate a class is deprecated. +- The ability to implement the RegExp class and the RegExpMatch class is + deprecated. [#61392]: https://dartbug.com/61392 [`@Deprecated.extend()`]: https://api.dart.dev/dev/latest/dart-core/Deprecated/Deprecated.extend.html diff --git a/sdk/lib/core/regexp.dart b/sdk/lib/core/regexp.dart index 048f6215784..6b10339292b 100644 --- a/sdk/lib/core/regexp.dart +++ b/sdk/lib/core/regexp.dart @@ -213,6 +213,10 @@ part of "dart:core"; /// when the regexp does not find a match. /// Several guides to [improving the performance of regular expressions](https://www.google.com/search?q=performance+of+regular+expressions) /// exist on the internet. Use these as inspirations, too. +@Deprecated.implement( + "This class will become 'final' in a future release. " + "'Pattern' may be a more appropriate interface to implement.", +) abstract interface class RegExp implements Pattern { /// Constructs a regular expression. /// @@ -468,6 +472,10 @@ abstract interface class RegExp implements Pattern { /// // This is the second message. /// } /// ``` +@Deprecated.implement( + "This class will become 'final' in a future release." + "'Match' may be a more appropriate interface to implement.", +) abstract interface class RegExpMatch implements Match { /// The string captured by the named capture group [name]. ///