[L] Change in dart/sdk[main]: Analyzer warnings: add support for @Deprecation.subclass

0 views
Skip to first unread message

Konstantin Shcheglov (Gerrit)

unread,
Aug 6, 2025, 12:16:07 PM8/6/25
to Samuel Rawlins, Brian Wilkerson, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Samuel Rawlins

Konstantin Shcheglov voted and added 4 comments

Votes added by Konstantin Shcheglov

Code-Review+1

4 comments

File pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart
Line 145, Patchset 3 (Latest):class B implements A {}
Konstantin Shcheglov . unresolved

Do we care about `with` when older language version?
```
// @dart = 2.12
class A {}

class B extends Object with A {}
```

File pkg/analyzer/lib/src/error/annotation_verifier.dart
Line 211, Patchset 3 (Latest): if (classElement == null) return;
Konstantin Shcheglov . unresolved

FWIW, at this point it must have a fragment and element.

Line 226, Patchset 3 (Latest): if (element is ClassElement &&
Konstantin Shcheglov . unresolved

It looks that we repeat conditions. Maybe update two previous checks to go from AST to elements, and then check elements as here?

File pkg/analyzer/test/src/diagnostics/deprecated_subclass_test.dart
Line 61, Patchset 3 (Latest):class Bar implements Foo {}
Konstantin Shcheglov . unresolved

Do we want similar tests for mixins (`implements` and `on`) and enums?

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Wed, 06 Aug 2025 16:16:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Aug 6, 2025, 12:33:03 PM8/6/25
to Konstantin Shcheglov, Brian Wilkerson, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Konstantin Shcheglov

Samuel Rawlins added 4 comments

File pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart
Line 145, Patchset 3 (Latest):class B implements A {}
Konstantin Shcheglov . unresolved

Do we care about `with` when older language version?
```
// @dart = 2.12
class A {}

class B extends Object with A {}
```

Samuel Rawlins

Good question; it's not mentioned in https://github.com/dart-lang/sdk/issues/60504, but a good question for @l...@google.com

File pkg/analyzer/lib/src/error/annotation_verifier.dart
Line 211, Patchset 3 (Latest): if (classElement == null) return;
Konstantin Shcheglov . unresolved

FWIW, at this point it must have a fragment and element.

Samuel Rawlins

Do you mean it's desirable to use `declaredFragment!.element`? Is there a shorthand for this, or maybe `declaredFragmentOrThrow` like `typeOrThrow`?

Line 226, Patchset 3 (Latest): if (element is ClassElement &&
Konstantin Shcheglov . unresolved

It looks that we repeat conditions. Maybe update two previous checks to go from AST to elements, and then check elements as here?

Samuel Rawlins

I think it would be some hoops to jump through. We'd do a ClassDeclaration case, and a MixinDeclaration case, to set an `Element` variable. Then we'd have to again do a `ClassElement` case to access `.isImplementableOutside` and a MixinElement case to access `.isImplementableOutside`. *shrug*

File pkg/analyzer/test/src/diagnostics/deprecated_subclass_test.dart
Line 61, Patchset 3 (Latest):class Bar implements Foo {}
Konstantin Shcheglov . unresolved

Do we want similar tests for mixins (`implements` and `on`) and enums?

Samuel Rawlins

Hmm, with `on`, do you mean how testing how this annotation affects super-constraints? It isn't specified to affect that, but we could. I need to look at the rules of `sealed` and `final` again.

And enums cannot be implemented. Do you mean an enum that implements a class?

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Konstantin Shcheglov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Wed, 06 Aug 2025 16:32:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Konstantin Shcheglov <sche...@google.com>
satisfied_requirement
open
diffy

Brian Wilkerson (Gerrit)

unread,
Aug 6, 2025, 2:09:48 PM8/6/25
to Samuel Rawlins, Brian Wilkerson, Konstantin Shcheglov, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Konstantin Shcheglov and Samuel Rawlins

Brian Wilkerson voted and added 6 comments

Votes added by Brian Wilkerson

Code-Review+1

6 comments

File pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
Line 3567, Patchset 3: status: needsFix
Brian Wilkerson . resolved

There is an existing `RemoveAnnotation` fix that might be usable here.

File pkg/analyzer/lib/src/error/annotation_verifier.dart
Line 139, Patchset 3: var isSubclass = value.getField('_isSubclass')?.toBoolValue() ?? false;
Brian Wilkerson . resolved

I wonder whether it would be worthwhile to have extension methods for these tests. I seem to remember seeing this same pattern in a previous CL, and we might need to change all of them to look for specific enum values. Having one place to update might be good.

File pkg/analyzer/messages.yaml
Line 24230, Patchset 3: just remove the relevant `extends` clause or remove the class name from
Brian Wilkerson . unresolved

While it seems kind of trivial, consider adding a code snippet that shows the original code after the extends clause has been removed. (See below for rationale.)

Also, to be more consistent with other docs, consider something like

If the annotation contains a description of how to deal with not being able to subclass the class, then try following those directions.

If the annotation doesn't contain a description, or if the described approach isn't appropriate for your case, then remove the relevant `extends` clause or remove the class name from the `implements` clause:

```dart
import 'package:p/p.dart';

class D {}
```

Line 24919, Patchset 3: The analyzer produces this diagnostic when anything other than an
Brian Wilkerson . unresolved

nit: "an" --> "a"

Line 24921, Patchset 3: [`Deprecated.subclass`][meta-deprecated-subclass]. A subclassable
Brian Wilkerson . unresolved

I think this link can't work because the constructor doesn't yet exist. Given that the docs can be published at any time, we should probably remove the link for now and then try to remember to put them back in after the constructors have been defined.

Line 24937, Patchset 3: Remove the annotation.
Brian Wilkerson . unresolved

As silly as it seems, we should add code to which the recommendation has been applied:

Remove the annotation:
```dart
sealed class C {}
```

It's more consistent, and the example might help an LLM do a better job of fixing the problem.

Open in Gerrit

Related details

Attention is currently required from:
  • Konstantin Shcheglov
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 4
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Wed, 06 Aug 2025 18:09:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
Aug 6, 2025, 3:08:03 PM8/6/25
to Samuel Rawlins, Brian Wilkerson, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Samuel Rawlins

Konstantin Shcheglov voted and added 3 comments

Votes added by Konstantin Shcheglov

Code-Review+1

3 comments

File pkg/analyzer/lib/src/error/annotation_verifier.dart
Line 211, Patchset 3: if (classElement == null) return;
Konstantin Shcheglov . unresolved

FWIW, at this point it must have a fragment and element.

Samuel Rawlins

Do you mean it's desirable to use `declaredFragment!.element`? Is there a shorthand for this, or maybe `declaredFragmentOrThrow` like `typeOrThrow`?

Konstantin Shcheglov

No, we don't, I was just adding null asserts directly.
Should we add one? Maybe.

I'm considering a different name, like `declaredFragmentMust`.
There is no "or" in the places where we invoke it :-)

Line 226, Patchset 3: if (element is ClassElement &&
Konstantin Shcheglov . unresolved

It looks that we repeat conditions. Maybe update two previous checks to go from AST to elements, and then check elements as here?

Samuel Rawlins

I think it would be some hoops to jump through. We'd do a ClassDeclaration case, and a MixinDeclaration case, to set an `Element` variable. Then we'd have to again do a `ClassElement` case to access `.isImplementableOutside` and a MixinElement case to access `.isImplementableOutside`. *shrug*

Konstantin Shcheglov

But this what we do here: check for `is ClassElement` and then its permissions, right?
I'm totally can be wrong.

File pkg/analyzer/test/src/diagnostics/deprecated_subclass_test.dart
Line 61, Patchset 3:class Bar implements Foo {}
Konstantin Shcheglov . unresolved

Do we want similar tests for mixins (`implements` and `on`) and enums?

Samuel Rawlins

Hmm, with `on`, do you mean how testing how this annotation affects super-constraints? It isn't specified to affect that, but we could. I need to look at the rules of `sealed` and `final` again.

And enums cannot be implemented. Do you mean an enum that implements a class?

Konstantin Shcheglov

Yes, enum that implements a class.
And yes, `on` super-constraints. Theoretically these are almost equivalent to mixin implementing these (with ability for `super`).

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 4
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Wed, 06 Aug 2025 19:07:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Konstantin Shcheglov <sche...@google.com>
Comment-In-Reply-To: Samuel Rawlins <sraw...@google.com>
satisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Aug 7, 2025, 7:23:53 PM8/7/25
to Brian Wilkerson, Konstantin Shcheglov, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org

Samuel Rawlins added 8 comments

File pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart
Line 145, Patchset 3:class B implements A {}
Konstantin Shcheglov . resolved

Do we care about `with` when older language version?
```
// @dart = 2.12
class A {}

class B extends Object with A {}
```

Samuel Rawlins

Good question; it's not mentioned in https://github.com/dart-lang/sdk/issues/60504, but a good question for @l...@google.com

Samuel Rawlins

I've implemented it for now. It makes sense to me. If we want to change that later, it is non-breaking to stop reporting it.

File pkg/analyzer/lib/src/error/annotation_verifier.dart
Line 211, Patchset 3: if (classElement == null) return;
Konstantin Shcheglov . resolved

FWIW, at this point it must have a fragment and element.

Samuel Rawlins

Do you mean it's desirable to use `declaredFragment!.element`? Is there a shorthand for this, or maybe `declaredFragmentOrThrow` like `typeOrThrow`?

Konstantin Shcheglov

No, we don't, I was just adding null asserts directly.
Should we add one? Maybe.

I'm considering a different name, like `declaredFragmentMust`.
There is no "or" in the places where we invoke it :-)

Samuel Rawlins

Done

Line 226, Patchset 3: if (element is ClassElement &&
Konstantin Shcheglov . resolved

It looks that we repeat conditions. Maybe update two previous checks to go from AST to elements, and then check elements as here?

Samuel Rawlins

I think it would be some hoops to jump through. We'd do a ClassDeclaration case, and a MixinDeclaration case, to set an `Element` variable. Then we'd have to again do a `ClassElement` case to access `.isImplementableOutside` and a MixinElement case to access `.isImplementableOutside`. *shrug*

Konstantin Shcheglov

But this what we do here: check for `is ClassElement` and then its permissions, right?
I'm totally can be wrong.

Samuel Rawlins

OK I gave it a try and it is shorter, more concise. I like it, thanks!

File pkg/analyzer/messages.yaml
Line 24230, Patchset 3: just remove the relevant `extends` clause or remove the class name from
Brian Wilkerson . resolved

While it seems kind of trivial, consider adding a code snippet that shows the original code after the extends clause has been removed. (See below for rationale.)

Also, to be more consistent with other docs, consider something like

If the annotation contains a description of how to deal with not being able to subclass the class, then try following those directions.

If the annotation doesn't contain a description, or if the described approach isn't appropriate for your case, then remove the relevant `extends` clause or remove the class name from the `implements` clause:

```dart
import 'package:p/p.dart';

class D {}
```

Samuel Rawlins

Done

Line 24919, Patchset 3: The analyzer produces this diagnostic when anything other than an
Brian Wilkerson . resolved

nit: "an" --> "a"

Samuel Rawlins

Done

Line 24921, Patchset 3: [`Deprecated.subclass`][meta-deprecated-subclass]. A subclassable
Brian Wilkerson . resolved

I think this link can't work because the constructor doesn't yet exist. Given that the docs can be published at any time, we should probably remove the link for now and then try to remember to put them back in after the constructors have been defined.

Samuel Rawlins

Done

Line 24937, Patchset 3: Remove the annotation.
Brian Wilkerson . resolved

As silly as it seems, we should add code to which the recommendation has been applied:

Remove the annotation:
```dart
sealed class C {}
```

It's more consistent, and the example might help an LLM do a better job of fixing the problem.

Samuel Rawlins

Done

File pkg/analyzer/test/src/diagnostics/deprecated_subclass_test.dart
Line 61, Patchset 3:class Bar implements Foo {}
Konstantin Shcheglov . resolved

Do we want similar tests for mixins (`implements` and `on`) and enums?

Samuel Rawlins

Hmm, with `on`, do you mean how testing how this annotation affects super-constraints? It isn't specified to affect that, but we could. I need to look at the rules of `sealed` and `final` again.

And enums cannot be implemented. Do you mean an enum that implements a class?

Konstantin Shcheglov

Yes, enum that implements a class.
And yes, `on` super-constraints. Theoretically these are almost equivalent to mixin implementing these (with ability for `super`).

Samuel Rawlins

OK, I see. This makes sense to me. Added impl and tests.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 4
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Comment-Date: Thu, 07 Aug 2025 23:23:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Konstantin Shcheglov <sche...@google.com>
Comment-In-Reply-To: Samuel Rawlins <sraw...@google.com>
Comment-In-Reply-To: Brian Wilkerson <brianwi...@google.com>
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
Aug 7, 2025, 7:26:53 PM8/7/25
to Samuel Rawlins, Brian Wilkerson, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Samuel Rawlins

Konstantin Shcheglov voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 5
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Thu, 07 Aug 2025 23:26:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Aug 7, 2025, 9:56:15 PM8/7/25
to Konstantin Shcheglov, Brian Wilkerson, Lasse Nielsen, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson

Samuel Rawlins voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 6
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Fri, 08 Aug 2025 01:56:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Aug 7, 2025, 9:56:23 PM8/7/25
to Samuel Rawlins, Konstantin Shcheglov, Brian Wilkerson, Lasse Nielsen, dart-analys...@google.com, rev...@dartlang.org

Commit Queue submitted the change with unreviewed changes

Unreviewed changes

5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: pkg/analyzer/messages.yaml
Insertions: 8, Deletions: 2.

@@ -24050,6 +24050,10 @@

Follow any directions found in the `Deprecation.extend` annotation, or
just remove the `extends` clause.
+
+ ```dart
+ class D {}
+ ```
DEPRECATED_EXTENDS_FUNCTION:
sharedName: DEPRECATED_SUBTYPE_OF_FUNCTION
problemMessage: "Extending 'Function' is deprecated."
@@ -24121,6 +24125,10 @@

Follow any directions found in the `Deprecation.implement` annotation, or
just remove the class name from the `implements` clause.
+
+ ```dart
+ class D {}
+ ```
DEPRECATED_IMPLEMENTS_FUNCTION:
sharedName: DEPRECATED_SUBTYPE_OF_FUNCTION
problemMessage: "Implementing 'Function' has no effect."
@@ -24234,8 +24242,6 @@

`extends` clause or remove the class name from the `implements` clause:

```dart
-      import 'package:p/p.dart';
-
class D {}
```
DOC_DIRECTIVE_HAS_EXTRA_ARGUMENTS:
```

Change information

Commit message:
Analyzer warnings: add support for @Deprecation.subclass

Work towards https://github.com/dart-lang/sdk/issues/60504

* The annotation causes certain usage to generate a warning (+ tests).
* Possible fixes for this new warning are offered (+ tests).
* Placing the annotation on an invalid element generates a different
warning (+ tests).
Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Commit-Queue: Samuel Rawlins <sraw...@google.com>
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Files:
  • M pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
  • M pkg/analysis_server/lib/src/services/correction/fix_internal.dart
  • M pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart
  • M pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
  • M pkg/analyzer/lib/src/error/annotation_verifier.dart
  • M pkg/analyzer/lib/src/error/best_practices_verifier.dart
  • M pkg/analyzer/lib/src/error/codes.g.dart
  • M pkg/analyzer/lib/src/error/deprecated_functionality_verifier.dart
  • M pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
  • M pkg/analyzer/messages.yaml
  • M pkg/analyzer/test/src/diagnostics/deprecated_implement_test.dart
  • A pkg/analyzer/test/src/diagnostics/deprecated_subclass_test.dart
  • A pkg/analyzer/test/src/diagnostics/invalid_deprecated_subclass_annotation_test.dart
  • M pkg/analyzer/test/src/diagnostics/test_all.dart
Change size: L
Delta: 14 files changed, 555 insertions(+), 50 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Konstantin Shcheglov
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Icbb956e88ed4325f96fbe54b7eea7fcc18a4ab57
Gerrit-Change-Number: 443901
Gerrit-PatchSet: 7
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Lasse Nielsen <l...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages