diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart index 3406875780f..0608b1fc336 100644 --- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart +++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart @@ -1232,12 +1232,11 @@ class HintCode extends AnalyzerErrorCode { * This hint is generated anywhere where `@nonVirtual` annotates something * other than a non-abstract instance member in a class or mixin. * - * Parameters: - * 0: the name of the member + * No Parameters. */ static const HintCode INVALID_NON_VIRTUAL_ANNOTATION = HintCode( 'INVALID_NON_VIRTUAL_ANNOTATION', - "The member '{0}' can't be '@nonVirtual' because it isn't a concrete instance member.", + "The annotation '@nonVirtual' can only be applied to a concrete instance member.", correctionMessage: "Try removing @nonVirtual.", ); @@ -1297,12 +1296,11 @@ class HintCode extends AnalyzerErrorCode { * This hint is generated anywhere where `@sealed` annotates something other * than a class. * - * Parameters: - * 0: the name of the member + * No parameters. */ static const HintCode INVALID_SEALED_ANNOTATION = HintCode( 'INVALID_SEALED_ANNOTATION', - "The member '{0}' is annotated with '@sealed' but only classes can be annotated with it.", + "The annotation '@sealed' can only be applied to classes.", correctionMessage: "Remove @sealed.", ); diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart index 48cb56a026b..a8de577465e 100644 --- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart +++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart @@ -201,29 +201,23 @@ class BestPracticesVerifier extends RecursiveAstVisitor { if (parent is FieldDeclaration) { if (parent.isStatic) { _errorReporter.reportErrorForNode( - HintCode.INVALID_NON_VIRTUAL_ANNOTATION, - node, - [node.element!.name]); + HintCode.INVALID_NON_VIRTUAL_ANNOTATION, node); } } else if (parent is MethodDeclaration) { if (parent.parent is ExtensionDeclaration || parent.isStatic || parent.isAbstract) { _errorReporter.reportErrorForNode( - HintCode.INVALID_NON_VIRTUAL_ANNOTATION, - node, - [node.element!.name]); + HintCode.INVALID_NON_VIRTUAL_ANNOTATION, node); } } else { _errorReporter.reportErrorForNode( - HintCode.INVALID_NON_VIRTUAL_ANNOTATION, - node, - [node.element!.name]); + HintCode.INVALID_NON_VIRTUAL_ANNOTATION, node); } } else if (element.isSealed == true) { if (!(parent is ClassDeclaration || parent is ClassTypeAlias)) { _errorReporter.reportErrorForNode( - HintCode.INVALID_SEALED_ANNOTATION, node, [node.element!.name]); + HintCode.INVALID_SEALED_ANNOTATION, node); } } else if (element.isVisibleForTemplate == true || element.isVisibleForTesting == true || diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index bee1e3525a0..cf4a16061b9 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -14959,14 +14959,13 @@ HintCode: var x; ``` INVALID_NON_VIRTUAL_ANNOTATION: - problemMessage: "The member '{0}' can't be '@nonVirtual' because it isn't a concrete instance member." + problemMessage: "The annotation '@nonVirtual' can only be applied to a concrete instance member." correctionMessage: Try removing @nonVirtual. comment: |- This hint is generated anywhere where `@nonVirtual` annotates something other than a non-abstract instance member in a class or mixin. - Parameters: - 0: the name of the member + No Parameters. INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER: problemMessage: "The member '{0}' is declared non-virtual in '{1}' and can't be overridden in subclasses." comment: |- @@ -15070,14 +15069,13 @@ HintCode: } ``` INVALID_SEALED_ANNOTATION: - problemMessage: "The member '{0}' is annotated with '@sealed' but only classes can be annotated with it." + problemMessage: "The annotation '@sealed' can only be applied to classes." correctionMessage: Remove @sealed. comment: |- This hint is generated anywhere where `@sealed` annotates something other than a class. - Parameters: - 0: the name of the member + No parameters. INVALID_USE_OF_INTERNAL_MEMBER: problemMessage: "The member '{0}' can only be used within its package." comment: |-