Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: pkg/analyzer/lib/src/dart/error/hint_codes.dart

Issue 2775863004: Add error checking for the immutable annotation (issue 27750) (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.dart.error.hint_codes; 5 library analyzer.src.dart.error.hint_codes;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/dart/element/element.dart'; 8 import 'package:analyzer/src/dart/element/element.dart';
9 9
10 /** 10 /**
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 * object. 209 * object.
210 * 210 *
211 * Parameters: 211 * Parameters:
212 * 0: the name of the method 212 * 0: the name of the method
213 */ 213 */
214 static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode( 214 static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode(
215 'INVALID_FACTORY_METHOD_IMPL', 215 'INVALID_FACTORY_METHOD_IMPL',
216 "Factory method '{0}' doesn't return a newly allocated object."); 216 "Factory method '{0}' doesn't return a newly allocated object.");
217 217
218 /** 218 /**
219 * This hint is generated anywhere an @immutable annotation is associated with
220 * anything other than a class.
221 */
222 static const HintCode INVALID_IMMUTABLE_ANNOTATION = const HintCode(
223 'INVALID_IMMUTABLE_ANNOTATION',
224 "Only classes can be annotated as being immutable.");
225
226 /**
219 * Generic Method DEP: number of type parameters must match. 227 * Generic Method DEP: number of type parameters must match.
220 * <https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.m d#function-subtyping> 228 * <https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.m d#function-subtyping>
221 * 229 *
222 * Parameters: 230 * Parameters:
223 * 0: the number of type parameters in the method 231 * 0: the number of type parameters in the method
224 * 1: the number of type parameters in the overridden method 232 * 1: the number of type parameters in the overridden method
225 * 2: the name of the class where the overridden method is declared 233 * 2: the name of the class where the overridden method is declared
226 */ 234 */
227 static const HintCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS = const HintCode ( 235 static const HintCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS = const HintCode (
228 'INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS', 236 'INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS',
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 * Parameters: 346 * Parameters:
339 * 0: the name of the declared return type 347 * 0: the name of the declared return type
340 */ 348 */
341 static const HintCode MISSING_RETURN = const HintCode( 349 static const HintCode MISSING_RETURN = const HintCode(
342 'MISSING_RETURN', 350 'MISSING_RETURN',
343 "This function declares a return type of '{0}', but doesn't end with a " 351 "This function declares a return type of '{0}', but doesn't end with a "
344 "return statement.", 352 "return statement.",
345 "Try adding a return statement, or changing the return type to 'void'."); 353 "Try adding a return statement, or changing the return type to 'void'.");
346 354
347 /** 355 /**
356 * Generate a hint for classes that inherit from classes annotated with
357 * `@immutable` but that are not immutable.
358 */
359 static const HintCode MUST_BE_IMMUTABLE = const HintCode(
360 'MUST_BE_IMMUTABLE',
361 "This class inherits from a class marked as @immutable, "
362 "and therefore should be immutable (all fields must be final).");
363
364 /**
348 * Generate a hint for methods that override methods annotated `@mustCallSuper ` 365 * Generate a hint for methods that override methods annotated `@mustCallSuper `
349 * that do not invoke the overridden super method. 366 * that do not invoke the overridden super method.
350 * 367 *
351 * Parameters: 368 * Parameters:
352 * 0: the name of the class declaring the overridden method 369 * 0: the name of the class declaring the overridden method
353 */ 370 */
354 static const HintCode MUST_CALL_SUPER = const HintCode( 371 static const HintCode MUST_CALL_SUPER = const HintCode(
355 'MUST_CALL_SUPER', 372 'MUST_CALL_SUPER',
356 "This method overrides a method annotated as @mustCallSuper in '{0}', " 373 "This method overrides a method annotated as @mustCallSuper in '{0}', "
357 "but does not invoke the overridden method."); 374 "but does not invoke the overridden method.");
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 */ 651 */
635 const HintCode(String name, String message, [String correction]) 652 const HintCode(String name, String message, [String correction])
636 : super(name, message, correction); 653 : super(name, message, correction);
637 654
638 @override 655 @override
639 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; 656 ErrorSeverity get errorSeverity => ErrorType.HINT.severity;
640 657
641 @override 658 @override
642 ErrorType get type => ErrorType.HINT; 659 ErrorType get type => ErrorType.HINT;
643 } 660 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698