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

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

Issue 257773008: New analyzer snapshot, based on r35422. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update pubspec.yaml Created 6 years, 8 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.error; 8 library engine.error;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
11 import 'source.dart'; 11 import 'source.dart';
12 import 'scanner.dart' show Token; 12 import 'scanner.dart' show Token;
13 import 'ast.dart' show AstNode; 13 import 'ast.dart' show AstNode;
14 import 'element.dart' show Element; 14 import 'element.dart' show Element;
15 15
16 /** 16 /**
17 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er rorCode] 17 * The enumeration `PubSuggestionCode` defines the suggestions used for reportin g deviations
18 * . 18 * from pub best practices. The convention for this class is for the name of the bad practice to
19 * indicate the problem that caused the suggestion to be generated and for the m essage to explain
20 * what is wrong and, when appropriate, how the situation can be corrected.
19 */ 21 */
20 class ErrorSeverity extends Enum<ErrorSeverity> { 22 class PubSuggestionCode extends Enum<PubSuggestionCode> implements ErrorCode {
21 /** 23 /**
22 * The severity representing a non-error. This is never used for any error cod e, but is useful for 24 * It is a bad practice for a source file in a package "lib" directory hierarc hy to traverse
23 * clients. 25 * outside that directory hierarchy. For example, a source file in the "lib" d irectory should not
24 */ 26 * contain a directive such as `import '../web/some.dart'` which references a file outside
25 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); 27 * the lib directory.
26 28 */
27 /** 29 static const PubSuggestionCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = const PubSuggestionCode.con1('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', 0, "A file in the 'lib' directory hierarchy should not reference a file outside that hierarchy");
28 * The severity representing an informational level analysis issue. 30
29 */ 31 /**
30 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); 32 * It is a bad practice for a source file ouside a package "lib" directory hie rarchy to traverse
31 33 * into that directory hierarchy. For example, a source file in the "web" dire ctory should not
32 /** 34 * contain a directive such as `import '../lib/some.dart'` which references a file inside
33 * The severity representing a warning. Warnings can become errors if the `-We rror` command 35 * the lib directory.
34 * line flag is specified. 36 */
35 */ 37 static const PubSuggestionCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = const PubSuggestionCode.con1('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', 1, "A file outside the 'lib' directory hierarchy should not reference a file in side that hierarchy. Use a package: reference instead.");
36 static const ErrorSeverity WARNING = const ErrorSeverity('WARNING', 2, "W", "w arning"); 38
37 39 /**
38 /** 40 * It is a bad practice for a package import to reference anything outside the given package, or
39 * The severity representing an error. 41 * more generally, it is bad practice for a package import to contain a "..". For example, a
40 */ 42 * source file should not contain a directive such as `import 'package:foo/../ some.dart'`.
41 static const ErrorSeverity ERROR = const ErrorSeverity('ERROR', 3, "E", "error "); 43 */
42 44 static const PubSuggestionCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const PubSugg estionCode.con1('PACKAGE_IMPORT_CONTAINS_DOT_DOT', 2, "A package import should n ot contain '..'");
43 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; 45
44 46 static const List<PubSuggestionCode> values = const [
45 /** 47 FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
46 * The name of the severity used when producing machine output. 48 FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE,
47 */ 49 PACKAGE_IMPORT_CONTAINS_DOT_DOT];
48 final String machineCode;
49
50 /**
51 * The name of the severity used when producing readable output.
52 */
53 final String displayName;
54
55 /**
56 * Initialize a newly created severity with the given names.
57 *
58 * @param machineCode the name of the severity used when producing machine out put
59 * @param displayName the name of the severity used when producing readable ou tput
60 */
61 const ErrorSeverity(String name, int ordinal, this.machineCode, this.displayNa me) : super(name, ordinal);
62
63 /**
64 * Return the severity constant that represents the greatest severity.
65 *
66 * @param severity the severity being compared against
67 * @return the most sever of this or the given severity
68 */
69 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal ? this : severity;
70 }
71
72 /**
73 * Instances of the class `AnalysisErrorWithProperties`
74 */
75 class AnalysisErrorWithProperties extends AnalysisError {
76 /**
77 * The properties associated with this error.
78 */
79 Map<ErrorProperty, Object> _propertyMap = new Map<ErrorProperty, Object>();
80
81 /**
82 * Initialize a newly created analysis error for the specified source. The err or has no location
83 * information.
84 *
85 * @param source the source for which the exception occurred
86 * @param errorCode the error code to be associated with this error
87 * @param arguments the arguments used to build the error message
88 */
89 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje ct> arguments) : super.con1(source, errorCode, arguments);
90
91 /**
92 * Initialize a newly created analysis error for the specified source at the g iven location.
93 *
94 * @param source the source for which the exception occurred
95 * @param offset the offset of the location of the error
96 * @param length the length of the location of the error
97 * @param errorCode the error code to be associated with this error
98 * @param arguments the arguments used to build the error message
99 */
100 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro rCode, arguments);
101
102 @override
103 Object getProperty(ErrorProperty property) => _propertyMap[property];
104
105 /**
106 * Set the value of the given property to the given value. Using a value of `n ull` will
107 * effectively remove the property from this error.
108 *
109 * @param property the property whose value is to be returned
110 * @param value the new value of the given property
111 */
112 void setProperty(ErrorProperty property, Object value) {
113 _propertyMap[property] = value;
114 }
115 }
116
117 /**
118 * Instances of the class `BooleanErrorListener` implement a listener that keeps track of
119 * whether an error has been reported to it.
120 */
121 class BooleanErrorListener implements AnalysisErrorListener {
122 /**
123 * A flag indicating whether an error has been reported to this listener.
124 */
125 bool _errorReported = false;
126
127 /**
128 * Return `true` if an error has been reported to this listener.
129 *
130 * @return `true` if an error has been reported to this listener
131 */
132 bool get errorReported => _errorReported;
133
134 @override
135 void onError(AnalysisError error) {
136 _errorReported = true;
137 }
138 }
139
140 /**
141 * The enumeration `PolymerCode` defines Polymer specific problems.
142 */
143 class PolymerCode extends Enum<PolymerCode> implements ErrorCode {
144 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode('AT TRIBUTE_FIELD_NOT_PUBLISHED', 0, "Field '%s' in '%s' must be @published");
145
146 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode('D UPLICATE_ATTRIBUTE_DEFINITION', 1, "The attribute '%s' is already defined");
147
148 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode('EMPTY_ATTRIBUTE S', 2, "Empty 'attributes' attribute is useless");
149
150 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode('INVALID_A TTRIBUTE_NAME', 3, "'%s' is not a valid name for a custom element attribute");
151
152 static const PolymerCode INVALID_TAG_NAME = const PolymerCode('INVALID_TAG_NAM E', 4, "'%s' is not a valid name for a custom element");
153
154 static const PolymerCode MISSING_TAG_NAME = const PolymerCode('MISSING_TAG_NAM E', 5, "Missing tag name of the custom element. Please include an attribute like name='your-tag-name'");
155
156 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode('UNDEFI NED_ATTRIBUTE_FIELD', 6, "There is no such field '%s' in '%s'");
157
158 static const List<PolymerCode> values = const [
159 ATTRIBUTE_FIELD_NOT_PUBLISHED,
160 DUPLICATE_ATTRIBUTE_DEFINITION,
161 EMPTY_ATTRIBUTES,
162 INVALID_ATTRIBUTE_NAME,
163 INVALID_TAG_NAME,
164 MISSING_TAG_NAME,
165 UNDEFINED_ATTRIBUTE_FIELD];
166
167 /**
168 * The template used to create the message to be displayed for this error.
169 */
170 final String message;
171
172 /**
173 * Initialize a newly created error code to have the given message.
174 *
175 * @param message the message template used to create the message to be displa yed for the error
176 */
177 const PolymerCode(String name, int ordinal, this.message) : super(name, ordina l);
178
179 @override
180 String get correction => null;
181
182 @override
183 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
184
185 @override
186 ErrorType get type => ErrorType.POLYMER;
187 }
188
189 /**
190 * The enumeration `AngularCode` defines Angular specific problems.
191 */
192 class AngularCode extends Enum<AngularCode> implements ErrorCode {
193 static const AngularCode CANNOT_PARSE_SELECTOR = const AngularCode('CANNOT_PAR SE_SELECTOR', 0, "The selector '%s' cannot be parsed");
194
195 static const AngularCode INVALID_FORMATTER_NAME = const AngularCode('INVALID_F ORMATTER_NAME', 1, "Formatter name must be a simple identifier");
196
197 static const AngularCode INVALID_PROPERTY_KIND = const AngularCode('INVALID_PR OPERTY_KIND', 2, "Unknown property binding kind '%s', use one of the '@', '=>', '=>!' or '<=>'");
198
199 static const AngularCode INVALID_PROPERTY_FIELD = const AngularCode('INVALID_P ROPERTY_FIELD', 3, "Unknown property field '%s'");
200
201 static const AngularCode INVALID_PROPERTY_MAP = const AngularCode('INVALID_PRO PERTY_MAP', 4, "Argument 'map' must be a constant map literal");
202
203 static const AngularCode INVALID_PROPERTY_NAME = const AngularCode('INVALID_PR OPERTY_NAME', 5, "Property name must be a string literal");
204
205 static const AngularCode INVALID_PROPERTY_SPEC = const AngularCode('INVALID_PR OPERTY_SPEC', 6, "Property binding specification must be a string literal");
206
207 static const AngularCode INVALID_REPEAT_SYNTAX = const AngularCode('INVALID_RE PEAT_SYNTAX', 7, "Expected statement in form '_item_ in _collection_ [tracked by _id_]'");
208
209 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX = const AngularCode('INVAL ID_REPEAT_ITEM_SYNTAX', 8, "Item must by identifier or in '(_key_, _value_)' pai r.");
210
211 static const AngularCode INVALID_URI = const AngularCode('INVALID_URI', 9, "In valid URI syntax: '%s'");
212
213 static const AngularCode MISSING_FORMATTER_COLON = const AngularCode('MISSING_ FORMATTER_COLON', 10, "Missing ':' before formatter argument");
214
215 static const AngularCode MISSING_NAME = const AngularCode('MISSING_NAME', 11, "Argument 'name' must be provided");
216
217 static const AngularCode MISSING_PUBLISH_AS = const AngularCode('MISSING_PUBLI SH_AS', 12, "Argument 'publishAs' must be provided");
218
219 static const AngularCode MISSING_SELECTOR = const AngularCode('MISSING_SELECTO R', 13, "Argument 'selector' must be provided");
220
221 static const AngularCode URI_DOES_NOT_EXIST = const AngularCode('URI_DOES_NOT_ EXIST', 14, "Target of URI does not exist: '%s'");
222
223 static const List<AngularCode> values = const [
224 CANNOT_PARSE_SELECTOR,
225 INVALID_FORMATTER_NAME,
226 INVALID_PROPERTY_KIND,
227 INVALID_PROPERTY_FIELD,
228 INVALID_PROPERTY_MAP,
229 INVALID_PROPERTY_NAME,
230 INVALID_PROPERTY_SPEC,
231 INVALID_REPEAT_SYNTAX,
232 INVALID_REPEAT_ITEM_SYNTAX,
233 INVALID_URI,
234 MISSING_FORMATTER_COLON,
235 MISSING_NAME,
236 MISSING_PUBLISH_AS,
237 MISSING_SELECTOR,
238 URI_DOES_NOT_EXIST];
239
240 /**
241 * The template used to create the message to be displayed for this error.
242 */
243 final String message;
244
245 /**
246 * Initialize a newly created error code to have the given message.
247 *
248 * @param message the message template used to create the message to be displa yed for the error
249 */
250 const AngularCode(String name, int ordinal, this.message) : super(name, ordina l);
251
252 @override
253 String get correction => null;
254
255 @override
256 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
257
258 @override
259 ErrorType get type => ErrorType.ANGULAR;
260 }
261
262 /**
263 * Instances of the class `ErrorReporter` wrap an error listener with utility me thods used to
264 * create the errors being reported.
265 */
266 class ErrorReporter {
267 /**
268 * The error listener to which errors will be reported.
269 */
270 final AnalysisErrorListener _errorListener;
271
272 /**
273 * The default source to be used when reporting errors.
274 */
275 final Source _defaultSource;
276
277 /**
278 * The source to be used when reporting errors.
279 */
280 Source _source;
281
282 /**
283 * Initialize a newly created error reporter that will report errors to the gi ven listener.
284 *
285 * @param errorListener the error listener to which errors will be reported
286 * @param defaultSource the default source to be used when reporting errors
287 */
288 ErrorReporter(this._errorListener, this._defaultSource) {
289 if (_errorListener == null) {
290 throw new IllegalArgumentException("An error listener must be provided");
291 } else if (_defaultSource == null) {
292 throw new IllegalArgumentException("A default source must be provided");
293 }
294 this._source = _defaultSource;
295 }
296
297 /**
298 * Creates an error with properties with the given error code and arguments.
299 *
300 * @param errorCode the error code of the error to be reported
301 * @param node the node specifying the location of the error
302 * @param arguments the arguments to the error, used to compose the error mess age
303 */
304 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, AstNod e node, List<Object> arguments) => new AnalysisErrorWithProperties.con2(_source, node.offset, node.length, errorCode, arguments);
305
306 /**
307 * Report a passed error.
308 *
309 * @param error the error to report
310 */
311 void reportError(AnalysisError error) {
312 _errorListener.onError(error);
313 }
314
315 /**
316 * Report an error with the given error code and arguments.
317 *
318 * @param errorCode the error code of the error to be reported
319 * @param node the node specifying the location of the error
320 * @param arguments the arguments to the error, used to compose the error mess age
321 */
322 void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> argume nts) {
323 reportErrorForOffset(errorCode, node.offset, node.length, arguments);
324 }
325
326 /**
327 * Report an error with the given error code and arguments.
328 *
329 * @param errorCode the error code of the error to be reported
330 * @param element the element which name should be used as the location of the error
331 * @param arguments the arguments to the error, used to compose the error mess age
332 */
333 void reportErrorForElement(ErrorCode errorCode, Element element, List<Object> arguments) {
334 reportErrorForOffset(errorCode, element.nameOffset, element.displayName.leng th, arguments);
335 }
336
337 /**
338 * Report an error with the given error code and arguments.
339 *
340 * @param errorCode the error code of the error to be reported
341 * @param offset the offset of the location of the error
342 * @param length the length of the location of the error
343 * @param arguments the arguments to the error, used to compose the error mess age
344 */
345 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Ob ject> arguments) {
346 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error Code, arguments));
347 }
348
349 /**
350 * Report an error with the given error code and arguments.
351 *
352 * @param errorCode the error code of the error to be reported
353 * @param token the token specifying the location of the error
354 * @param arguments the arguments to the error, used to compose the error mess age
355 */
356 void reportErrorForToken(ErrorCode errorCode, Token token, List<Object> argume nts) {
357 reportErrorForOffset(errorCode, token.offset, token.length, arguments);
358 }
359
360 /**
361 * Set the source to be used when reporting errors. Setting the source to `nul l` will cause
362 * the default source to be used.
363 *
364 * @param source the source to be used when reporting errors
365 */
366 void set source(Source source) {
367 this._source = source == null ? _defaultSource : source;
368 }
369 }
370
371 /**
372 * Instances of the class `AnalysisError` represent an error discovered during t he analysis of
373 * some Dart code.
374 *
375 * @see AnalysisErrorListener
376 */
377 class AnalysisError {
378 /**
379 * An empty array of errors used when no errors are expected.
380 */
381 static List<AnalysisError> NO_ERRORS = new List<AnalysisError>(0);
382
383 /**
384 * A [Comparator] that sorts by the name of the file that the [AnalysisError] was
385 * found.
386 */
387 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, Analysis Error o2) => o1.source.shortName.compareTo(o2.source.shortName);
388
389 /**
390 * A [Comparator] that sorts error codes first by their severity (errors first , warnings
391 * second), and then by the the error code type.
392 */
393 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, An alysisError o2) {
394 ErrorCode errorCode1 = o1.errorCode;
395 ErrorCode errorCode2 = o2.errorCode;
396 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity;
397 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity;
398 ErrorType errorType1 = errorCode1.type;
399 ErrorType errorType2 = errorCode2.type;
400 if (errorSeverity1 == errorSeverity2) {
401 return errorType1.compareTo(errorType2);
402 } else {
403 return errorSeverity2.compareTo(errorSeverity1);
404 }
405 };
406
407 /**
408 * The error code associated with the error.
409 */
410 final ErrorCode errorCode;
411
412 /**
413 * The localized error message.
414 */
415 String _message;
416
417 /**
418 * The correction to be displayed for this error, or `null` if there is no cor rection
419 * information for this error.
420 */
421 String _correction;
422
423 /**
424 * The source in which the error occurred, or `null` if unknown.
425 */
426 Source source;
427
428 /**
429 * The character offset from the beginning of the source (zero based) where th e error occurred.
430 */
431 int _offset = 0;
432
433 /**
434 * The number of characters from the offset to the end of the source which enc ompasses the
435 * compilation error.
436 */
437 int _length = 0;
438
439 /**
440 * A flag indicating whether this error can be shown to be a non-issue because of the result of
441 * type propagation.
442 */
443 bool isStaticOnly = false;
444
445 /**
446 * Initialize a newly created analysis error for the specified source. The err or has no location
447 * information.
448 *
449 * @param source the source for which the exception occurred
450 * @param errorCode the error code to be associated with this error
451 * @param arguments the arguments used to build the error message
452 */
453 AnalysisError.con1(this.source, this.errorCode, List<Object> arguments) {
454 this._message = JavaString.format(errorCode.message, arguments);
455 }
456
457 /**
458 * Initialize a newly created analysis error for the specified source at the g iven location.
459 *
460 * @param source the source for which the exception occurred
461 * @param offset the offset of the location of the error
462 * @param length the length of the location of the error
463 * @param errorCode the error code to be associated with this error
464 * @param arguments the arguments used to build the error message
465 */
466 AnalysisError.con2(this.source, int offset, int length, this.errorCode, List<O bject> arguments) {
467 this._offset = offset;
468 this._length = length;
469 this._message = JavaString.format(errorCode.message, arguments);
470 String correctionTemplate = errorCode.correction;
471 if (correctionTemplate != null) {
472 this._correction = JavaString.format(correctionTemplate, arguments);
473 }
474 }
475
476 @override
477 bool operator ==(Object obj) {
478 if (identical(obj, this)) {
479 return true;
480 }
481 // prepare other AnalysisError
482 if (obj is! AnalysisError) {
483 return false;
484 }
485 AnalysisError other = obj as AnalysisError;
486 // Quick checks.
487 if (!identical(errorCode, other.errorCode)) {
488 return false;
489 }
490 if (_offset != other._offset || _length != other._length) {
491 return false;
492 }
493 if (isStaticOnly != other.isStaticOnly) {
494 return false;
495 }
496 // Deep checks.
497 if (_message != other._message) {
498 return false;
499 }
500 if (source != other.source) {
501 return false;
502 }
503 // OK
504 return true;
505 }
506
507 /**
508 * Return the correction to be displayed for this error, or `null` if there is no correction
509 * information for this error. The correction should indicate how the user can fix the error.
510 *
511 * @return the template used to create the correction to be displayed for this error
512 */
513 String get correction => _correction;
514
515 /**
516 * Return the number of characters from the offset to the end of the source wh ich encompasses the
517 * compilation error.
518 *
519 * @return the length of the error location
520 */
521 int get length => _length;
522
523 /**
524 * Return the message to be displayed for this error. The message should indic ate what is wrong
525 * and why it is wrong.
526 *
527 * @return the message to be displayed for this error
528 */
529 String get message => _message;
530
531 /**
532 * Return the character offset from the beginning of the source (zero based) w here the error
533 * occurred.
534 *
535 * @return the offset to the start of the error location
536 */
537 int get offset => _offset;
538
539 /**
540 * Return the value of the given property, or `null` if the given property is not defined
541 * for this error.
542 *
543 * @param property the property whose value is to be returned
544 * @return the value of the given property
545 */
546 Object getProperty(ErrorProperty property) => null;
547
548 @override
549 int get hashCode {
550 int hashCode = _offset;
551 hashCode ^= (_message != null) ? _message.hashCode : 0;
552 hashCode ^= (source != null) ? source.hashCode : 0;
553 return hashCode;
554 }
555
556 @override
557 String toString() {
558 JavaStringBuilder builder = new JavaStringBuilder();
559 builder.append((source != null) ? source.fullName : "<unknown source>");
560 builder.append("(");
561 builder.append(_offset);
562 builder.append("..");
563 builder.append(_offset + _length - 1);
564 builder.append("): ");
565 //builder.append("(" + lineNumber + ":" + columnNumber + "): ");
566 builder.append(_message);
567 return builder.toString();
568 }
569 }
570
571 /**
572 * The enumeration `ErrorProperty` defines the properties that can be associated with an
573 * [AnalysisError].
574 */
575 class ErrorProperty extends Enum<ErrorProperty> {
576 /**
577 * A property whose value is an array of [ExecutableElement] that should
578 * be but are not implemented by a concrete class.
579 */
580 static const ErrorProperty UNIMPLEMENTED_METHODS = const ErrorProperty('UNIMPL EMENTED_METHODS', 0);
581
582 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS];
583
584 const ErrorProperty(String name, int ordinal) : super(name, ordinal);
585 }
586
587 /**
588 * The enumeration `TodoCode` defines the single TODO `ErrorCode`.
589 */
590 class TodoCode extends Enum<TodoCode> implements ErrorCode {
591 /**
592 * The single enum of TodoCode.
593 */
594 static const TodoCode TODO = const TodoCode('TODO', 0);
595
596 static const List<TodoCode> values = const [TODO];
597
598 /**
599 * This matches the two common Dart task styles
600 *
601 * * TODO:
602 * * TODO(username):
603 *
604 * As well as
605 * * TODO
606 *
607 * But not
608 * * todo
609 * * TODOS
610 */
611 static RegExp TODO_REGEX = new RegExp("([\\s/\\*])((TODO[^\\w\\d][^\\r\\n]*)|( TODO:?\$))");
612
613 const TodoCode(String name, int ordinal) : super(name, ordinal);
614
615 @override
616 String get correction => null;
617
618 @override
619 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
620
621 @override
622 String get message => "%s";
623
624 @override
625 ErrorType get type => ErrorType.TODO;
626 }
627
628 /**
629 * The enumeration `HintCode` defines the hints and coding recommendations for b est practices
630 * which are not mentioned in the Dart Language Specification.
631 */
632 class HintCode extends Enum<HintCode> implements ErrorCode {
633 /**
634 * This hint is generated anywhere where the
635 * [StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, if we used
636 * propagated information for the warnings.
637 *
638 * @param actualType the name of the actual argument type
639 * @param expectedType the name of the expected type
640 * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
641 */
642 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode.con1('ARGU MENT_TYPE_NOT_ASSIGNABLE', 0, "The argument type '%s' cannot be assigned to the parameter type '%s'");
643
644 /**
645 * Dead code is code that is never reached, this can happen for instance if a statement follows a
646 * return statement.
647 */
648 static const HintCode DEAD_CODE = const HintCode.con1('DEAD_CODE', 1, "Dead co de");
649
650 /**
651 * Dead code is code that is never reached. This case covers cases where the u ser has catch
652 * clauses after `catch (e)` or `on Object catch (e)`.
653 */
654 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode.con1('D EAD_CODE_CATCH_FOLLOWING_CATCH', 2, "Dead code, catch clauses after a 'catch (e) ' or an 'on Object catch (e)' are never reached");
655
656 /**
657 * Dead code is code that is never reached. This case covers cases where the u ser has an on-catch
658 * clause such as `on A catch (e)`, where a supertype of `A` was already caugh t.
659 *
660 * @param subtypeName name of the subtype
661 * @param supertypeName name of the supertype
662 */
663 static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode.con1('DEAD_C ODE_ON_CATCH_SUBTYPE', 3, "Dead code, this on-catch block will never be executed since '%s' is a subtype of '%s'");
664
665 /**
666 * Deprecated members should not be invoked or used.
667 *
668 * @param memberName the name of the member
669 */
670 static const HintCode DEPRECATED_MEMBER_USE = const HintCode.con1('DEPRECATED_ MEMBER_USE', 4, "'%s' is deprecated");
671
672 /**
673 * Duplicate imports.
674 */
675 static const HintCode DUPLICATE_IMPORT = const HintCode.con1('DUPLICATE_IMPORT ', 5, "Duplicate import");
676
677 /**
678 * Hint to use the ~/ operator.
679 */
680 static const HintCode DIVISION_OPTIMIZATION = const HintCode.con1('DIVISION_OP TIMIZATION', 6, "The operator x ~/ y is more efficient than (x / y).toInt()");
681
682 /**
683 * Hint for the `x is double` type checks.
684 */
685 static const HintCode IS_DOUBLE = const HintCode.con1('IS_DOUBLE', 7, "When co mpiled to JS, this test might return true when the left hand side is an int");
686
687 /**
688 * Hint for the `x is int` type checks.
689 */
690 static const HintCode IS_INT = const HintCode.con1('IS_INT', 8, "When compiled to JS, this test might return true when the left hand side is a double");
691
692 /**
693 * Hint for the `x is! double` type checks.
694 */
695 static const HintCode IS_NOT_DOUBLE = const HintCode.con1('IS_NOT_DOUBLE', 9, "When compiled to JS, this test might return false when the left hand side is an int");
696
697 /**
698 * Hint for the `x is! int` type checks.
699 */
700 static const HintCode IS_NOT_INT = const HintCode.con1('IS_NOT_INT', 10, "When compiled to JS, this test might return false when the left hand side is a doubl e");
701
702 /**
703 * This hint is generated anywhere where the [StaticTypeWarningCode#INVALID_AS SIGNMENT]
704 * would have been generated, if we used propagated information for the warnin gs.
705 *
706 * @param rhsTypeName the name of the right hand side type
707 * @param lhsTypeName the name of the left hand side type
708 * @see StaticTypeWarningCode#INVALID_ASSIGNMENT
709 */
710 static const HintCode INVALID_ASSIGNMENT = const HintCode.con1('INVALID_ASSIGN MENT', 11, "A value of type '%s' cannot be assigned to a variable of type '%s'") ;
711
712 /**
713 * Generate a hint for methods or functions that have a return type, but do no t have a non-void
714 * return statement on all branches. At the end of methods or functions with n o return, Dart
715 * implicitly returns `null`, avoiding these implicit returns is considered a best practice.
716 *
717 * @param returnType the name of the declared return type
718 */
719 static const HintCode MISSING_RETURN = const HintCode.con2('MISSING_RETURN', 1 2, "This function declares a return type of '%s', but does not end with a return statement", "Either add a return statement or change the return type to 'void'" );
720
721 /**
722 * A getter with the override annotation does not override an existing getter.
723 */
724 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_GETTER', 13, "Getter does not override an inherited getter");
725
726 /**
727 * A method with the override annotation does not override an existing method.
728 */
729 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_METHOD', 14, "Method does not override an inherited method");
730
731 /**
732 * A setter with the override annotation does not override an existing setter.
733 */
734 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_SETTER', 15, "Setter does not override an inherited setter");
735
736 /**
737 * Hint for classes that override equals, but not hashCode.
738 *
739 * @param className the name of the current class
740 */
741 static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode.con1( 'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', 16, "The class '%s' overrides 'operator==', but not 'get hashCode'");
742
743 /**
744 * Type checks of the type `x is! Null` should be done with `x != null`.
745 */
746 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode.con1('TYPE_CHECK _IS_NOT_NULL', 17, "Tests for non-null should be done with '!= null'");
747
748 /**
749 * Type checks of the type `x is Null` should be done with `x == null`.
750 */
751 static const HintCode TYPE_CHECK_IS_NULL = const HintCode.con1('TYPE_CHECK_IS_ NULL', 18, "Tests for null should be done with '== null'");
752
753 /**
754 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ GETTER] or
755 * [StaticWarningCode#UNDEFINED_GETTER] would have been generated, if we used propagated
756 * information for the warnings.
757 *
758 * @param getterName the name of the getter
759 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for
760 * @see StaticTypeWarningCode#UNDEFINED_GETTER
761 * @see StaticWarningCode#UNDEFINED_GETTER
762 */
763 static const HintCode UNDEFINED_GETTER = const HintCode.con1('UNDEFINED_GETTER ', 19, "There is no such getter '%s' in '%s'");
764
765 /**
766 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ METHOD] would
767 * have been generated, if we used propagated information for the warnings.
768 *
769 * @param methodName the name of the method that is undefined
770 * @param typeName the resolved type name that the method lookup is happening on
771 * @see StaticTypeWarningCode#UNDEFINED_METHOD
772 */
773 static const HintCode UNDEFINED_METHOD = const HintCode.con1('UNDEFINED_METHOD ', 20, "The method '%s' is not defined for the class '%s'");
774
775 /**
776 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ OPERATOR]
777 * would have been generated, if we used propagated information for the warnin gs.
778 *
779 * @param operator the name of the operator
780 * @param enclosingType the name of the enclosing type where the operator is b eing looked for
781 * @see StaticTypeWarningCode#UNDEFINED_OPERATOR
782 */
783 static const HintCode UNDEFINED_OPERATOR = const HintCode.con1('UNDEFINED_OPER ATOR', 21, "There is no such operator '%s' in '%s'");
784
785 /**
786 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ SETTER] or
787 * [StaticWarningCode#UNDEFINED_SETTER] would have been generated, if we used propagated
788 * information for the warnings.
789 *
790 * @param setterName the name of the setter
791 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for
792 * @see StaticTypeWarningCode#UNDEFINED_SETTER
793 * @see StaticWarningCode#UNDEFINED_SETTER
794 */
795 static const HintCode UNDEFINED_SETTER = const HintCode.con1('UNDEFINED_SETTER ', 22, "There is no such setter '%s' in '%s'");
796
797 /**
798 * Unnecessary cast.
799 */
800 static const HintCode UNNECESSARY_CAST = const HintCode.con1('UNNECESSARY_CAST ', 23, "Unnecessary cast");
801
802 /**
803 * Unnecessary type checks, the result is always true.
804 */
805 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode.con1('UNNE CESSARY_TYPE_CHECK_FALSE', 24, "Unnecessary type check, the result is always fal se");
806
807 /**
808 * Unnecessary type checks, the result is always false.
809 */
810 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode.con1('UNNEC ESSARY_TYPE_CHECK_TRUE', 25, "Unnecessary type check, the result is always true" );
811
812 /**
813 * Unused imports are imports which are never not used.
814 */
815 static const HintCode UNUSED_IMPORT = const HintCode.con1('UNUSED_IMPORT', 26, "Unused import");
816
817 /**
818 * Hint for cases where the source expects a method or function to return a no n-void result, but
819 * the method or function signature returns void.
820 *
821 * @param name the name of the method or function that returns void
822 */
823 static const HintCode USE_OF_VOID_RESULT = const HintCode.con1('USE_OF_VOID_RE SULT', 27, "The result of '%s' is being used, even though it is declared to be ' void'");
824
825 static const List<HintCode> values = const [
826 ARGUMENT_TYPE_NOT_ASSIGNABLE,
827 DEAD_CODE,
828 DEAD_CODE_CATCH_FOLLOWING_CATCH,
829 DEAD_CODE_ON_CATCH_SUBTYPE,
830 DEPRECATED_MEMBER_USE,
831 DUPLICATE_IMPORT,
832 DIVISION_OPTIMIZATION,
833 IS_DOUBLE,
834 IS_INT,
835 IS_NOT_DOUBLE,
836 IS_NOT_INT,
837 INVALID_ASSIGNMENT,
838 MISSING_RETURN,
839 OVERRIDE_ON_NON_OVERRIDING_GETTER,
840 OVERRIDE_ON_NON_OVERRIDING_METHOD,
841 OVERRIDE_ON_NON_OVERRIDING_SETTER,
842 OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
843 TYPE_CHECK_IS_NOT_NULL,
844 TYPE_CHECK_IS_NULL,
845 UNDEFINED_GETTER,
846 UNDEFINED_METHOD,
847 UNDEFINED_OPERATOR,
848 UNDEFINED_SETTER,
849 UNNECESSARY_CAST,
850 UNNECESSARY_TYPE_CHECK_FALSE,
851 UNNECESSARY_TYPE_CHECK_TRUE,
852 UNUSED_IMPORT,
853 USE_OF_VOID_RESULT];
854 50
855 /** 51 /**
856 * The template used to create the message to be displayed for this error. 52 * The template used to create the message to be displayed for this error.
857 */ 53 */
858 final String message; 54 final String message;
859 55
860 /** 56 /**
861 * The template used to create the correction to be displayed for this error, or `null` if 57 * The template used to create the correction to be displayed for this error, or `null` if
862 * there is no correction information for this error. 58 * there is no correction information for this error.
863 */ 59 */
864 final String correction; 60 final String correction;
865 61
866 /** 62 /**
867 * Initialize a newly created error code to have the given message. 63 * Initialize a newly created error code to have the given message.
868 * 64 *
869 * @param message the message template used to create the message to be displa yed for the error 65 * @param message the message template used to create the message to be displa yed for the error
870 */ 66 */
871 const HintCode.con1(String name, int ordinal, String message) : this.con2(name , ordinal, message, null); 67 const PubSuggestionCode.con1(String name, int ordinal, String message) : this. con2(name, ordinal, message, null);
872 68
873 /** 69 /**
874 * Initialize a newly created error code to have the given message and correct ion. 70 * Initialize a newly created error code to have the given message and correct ion.
875 * 71 *
876 * @param message the template used to create the message to be displayed for the error 72 * @param message the template used to create the message to be displayed for the error
877 * @param correction the template used to create the correction to be displaye d for the error 73 * @param correction the template used to create the correction to be displaye d for the error
878 */ 74 */
879 const HintCode.con2(String name, int ordinal, this.message, this.correction) : super(name, ordinal); 75 const PubSuggestionCode.con2(String name, int ordinal, this.message, this.corr ection) : super(name, ordinal);
880 76
881 @override 77 @override
882 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; 78 ErrorSeverity get errorSeverity => ErrorType.PUB_SUGGESTION.severity;
883 79
884 @override 80 @override
885 ErrorType get type => ErrorType.HINT; 81 ErrorType get type => ErrorType.PUB_SUGGESTION;
886 } 82 }
887 83
888 /** 84 /**
889 * The interface `ErrorCode` defines the behavior common to objects representing error codes 85 * The enumeration `HtmlWarningCode` defines the error codes used for warnings i n HTML files.
890 * associated with [AnalysisError]. 86 * The convention for this class is for the name of the error code to indicate t he problem that
891 * 87 * caused the error to be generated and for the error message to explain what is wrong and, when
892 * Generally, we want to provide messages that consist of three sentences: 1. wh at is wrong, 2. why 88 * appropriate, how the problem can be corrected.
893 * is it wrong, and 3. how do I fix it. However, we combine the first two in the result of
894 * [getMessage] and the last in the result of [getCorrection].
895 */ 89 */
896 abstract class ErrorCode { 90 class HtmlWarningCode extends Enum<HtmlWarningCode> implements ErrorCode {
897 /** 91 /**
898 * Return the template used to create the correction to be displayed for this error, or 92 * An error code indicating that the value of the 'src' attribute of a Dart sc ript tag is not a
899 * `null` if there is no correction information for this error. The correction should 93 * valid URI.
900 * indicate how the user can fix the error. 94 *
901 * 95 * @param uri the URI that is invalid
902 * @return the template used to create the correction to be displayed for this error 96 */
903 */ 97 static const HtmlWarningCode INVALID_URI = const HtmlWarningCode.con1('INVALID _URI', 0, "Invalid URI syntax: '%s'");
904 String get correction; 98
905 99 /**
906 /** 100 * An error code indicating that the value of the 'src' attribute of a Dart sc ript tag references
907 * Return the severity of this error. 101 * a file that does not exist.
908 * 102 *
909 * @return the severity of this error 103 * @param uri the URI pointing to a non-existent file
910 */ 104 */
911 ErrorSeverity get errorSeverity; 105 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode.con1(' URI_DOES_NOT_EXIST', 1, "Target of URI does not exist: '%s'");
912 106
913 /** 107 static const List<HtmlWarningCode> values = const [INVALID_URI, URI_DOES_NOT_E XIST];
914 * Return the template used to create the message to be displayed for this err or. The message 108
915 * should indicate what is wrong and why it is wrong. 109 /**
916 * 110 * The template used to create the message to be displayed for this error.
917 * @return the template used to create the message to be displayed for this er ror 111 */
918 */ 112 final String message;
919 String get message; 113
920 114 /**
921 /** 115 * The template used to create the correction to be displayed for this error, or `null` if
922 * Return the type of the error. 116 * there is no correction information for this error.
923 * 117 */
924 * @return the type of the error 118 final String correction;
925 */ 119
926 ErrorType get type; 120 /**
927 } 121 * Initialize a newly created error code to have the given message.
928 122 *
929 /** 123 * @param message the message template used to create the message to be displa yed for the error
930 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode] . 124 */
931 */ 125 const HtmlWarningCode.con1(String name, int ordinal, String message) : this.co n2(name, ordinal, message, null);
932 class ErrorType extends Enum<ErrorType> { 126
933 /** 127 /**
934 * Task (todo) comments in user code. 128 * Initialize a newly created error code to have the given message and correct ion.
935 */ 129 *
936 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); 130 * @param message the template used to create the message to be displayed for the error
937 131 * @param correction the template used to create the correction to be displaye d for the error
938 /** 132 */
939 * Extra analysis run over the code to follow best practices, which are not in the Dart Language 133 const HtmlWarningCode.con2(String name, int ordinal, this.message, this.correc tion) : super(name, ordinal);
940 * Specification. 134
941 */ 135 @override
942 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); 136 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
943 137
944 /** 138 @override
945 * Compile-time errors are errors that preclude execution. A compile time erro r must be reported 139 ErrorType get type => ErrorType.STATIC_WARNING;
946 * by a Dart compiler before the erroneous code is executed.
947 */
948 static const ErrorType COMPILE_TIME_ERROR = const ErrorType('COMPILE_TIME_ERRO R', 2, ErrorSeverity.ERROR);
949
950 /**
951 * Suggestions made in situations where the user has deviated from recommended pub programming
952 * practices.
953 */
954 static const ErrorType PUB_SUGGESTION = const ErrorType('PUB_SUGGESTION', 3, E rrorSeverity.WARNING);
955
956 /**
957 * Static warnings are those warnings reported by the static checker. They hav e no effect on
958 * execution. Static warnings must be provided by Dart compilers used during d evelopment.
959 */
960 static const ErrorType STATIC_WARNING = const ErrorType('STATIC_WARNING', 4, E rrorSeverity.WARNING);
961
962 /**
963 * Many, but not all, static warnings relate to types, in which case they are known as static type
964 * warnings.
965 */
966 static const ErrorType STATIC_TYPE_WARNING = const ErrorType('STATIC_TYPE_WARN ING', 5, ErrorSeverity.WARNING);
967
968 /**
969 * Syntactic errors are errors produced as a result of input that does not con form to the grammar.
970 */
971 static const ErrorType SYNTACTIC_ERROR = const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR);
972
973 /**
974 * Angular specific semantic problems.
975 */
976 static const ErrorType ANGULAR = const ErrorType('ANGULAR', 7, ErrorSeverity.I NFO);
977
978 /**
979 * Polymer specific semantic problems.
980 */
981 static const ErrorType POLYMER = const ErrorType('POLYMER', 8, ErrorSeverity.I NFO);
982
983 static const List<ErrorType> values = const [
984 TODO,
985 HINT,
986 COMPILE_TIME_ERROR,
987 PUB_SUGGESTION,
988 STATIC_WARNING,
989 STATIC_TYPE_WARNING,
990 SYNTACTIC_ERROR,
991 ANGULAR,
992 POLYMER];
993
994 /**
995 * The severity of this type of error.
996 */
997 final ErrorSeverity severity;
998
999 /**
1000 * Initialize a newly created error type to have the given severity.
1001 *
1002 * @param severity the severity of this type of error
1003 */
1004 const ErrorType(String name, int ordinal, this.severity) : super(name, ordinal );
1005
1006 String get displayName => name.toLowerCase().replaceAll('_', ' ');
1007 } 140 }
1008 141
1009 /** 142 /**
1010 * The enumeration `CompileTimeErrorCode` defines the error codes used for compi le time 143 * The enumeration `CompileTimeErrorCode` defines the error codes used for compi le time
1011 * errors. The convention for this class is for the name of the error code to in dicate the problem 144 * errors. The convention for this class is for the name of the error code to in dicate the problem
1012 * that caused the error to be generated and for the error message to explain wh at is wrong and, 145 * that caused the error to be generated and for the error message to explain wh at is wrong and,
1013 * when appropriate, how the problem can be corrected. 146 * when appropriate, how the problem can be corrected.
1014 */ 147 */
1015 class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCo de { 148 class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCo de {
1016 /** 149 /**
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 258
1126 /** 259 /**
1127 * 7.6.3 Constant Constructors: It is a compile-time error if a constant const ructor is declared 260 * 7.6.3 Constant Constructors: It is a compile-time error if a constant const ructor is declared
1128 * by a class that has a non-final instance variable. 261 * by a class that has a non-final instance variable.
1129 * 262 *
1130 * The above refers to both locally declared and inherited instance variables. 263 * The above refers to both locally declared and inherited instance variables.
1131 */ 264 */
1132 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = con st CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 16, "Cann ot define the 'const' constructor for a class with non-final fields"); 265 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = con st CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 16, "Cann ot define the 'const' constructor for a class with non-final fields");
1133 266
1134 /** 267 /**
268 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type.
269 */
270 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = const CompileTimeErro rCode.con1('CONST_DEFERRED_CLASS', 17, "Deferred classes cannot be created with 'const'");
271
272 /**
1135 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not 273 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not
1136 * <b>null</b> and the interface of the class of <i>o</i> is not a subtype of the static type of 274 * <b>null</b> and the interface of the class of <i>o</i> is not a subtype of the static type of
1137 * the field <i>v</i>. 275 * the field <i>v</i>.
1138 * 276 *
1139 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 277 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
1140 * uncaught exception being thrown. 278 * uncaught exception being thrown.
1141 * 279 *
1142 * @param initializerType the name of the type of the initializer expression 280 * @param initializerType the name of the type of the initializer expression
1143 * @param fieldType the name of the type of the field 281 * @param fieldType the name of the type of the field
1144 */ 282 */
1145 static const CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = con st CompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 17, "The initializer type '%s' cannot be assigned to the field type '%s'"); 283 static const CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = con st CompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 18, "The initializer type '%s' cannot be assigned to the field type '%s'");
1146 284
1147 /** 285 /**
1148 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is declared as a 286 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is declared as a
1149 * constant variable. 287 * constant variable.
1150 */ 288 */
1151 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = const CompileTimeEr rorCode.con1('CONST_FORMAL_PARAMETER', 18, "Parameters cannot be 'const'"); 289 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = const CompileTimeEr rorCode.con1('CONST_FORMAL_PARAMETER', 19, "Parameters cannot be 'const'");
1152 290
1153 /** 291 /**
1154 * 5 Variables: A constant variable must be initialized to a compile-time cons tant or a 292 * 5 Variables: A constant variable must be initialized to a compile-time cons tant or a
1155 * compile-time error occurs. 293 * compile-time error occurs.
1156 */ 294 */
1157 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = const CompileTimeErrorCode.con1('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 19, "'const' variables must be constant value"); 295 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = const CompileTimeErrorCode.con1('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 20, "'const' variables must be constant value");
1158 296
1159 /** 297 /**
1160 * 7.5 Instance Variables: It is a compile-time error if an instance variable is declared to be 298 * 7.5 Instance Variables: It is a compile-time error if an instance variable is declared to be
1161 * constant. 299 * constant.
1162 */ 300 */
1163 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = const CompileTimeErro rCode.con1('CONST_INSTANCE_FIELD', 20, "Only static fields can be declared as 'c onst'"); 301 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = const CompileTimeErro rCode.con1('CONST_INSTANCE_FIELD', 21, "Only static fields can be declared as 'c onst'");
1164 302
1165 /** 303 /**
1166 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant map literal is an 304 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant map literal is an
1167 * instance of a class that implements the operator <i>==</i> unless the key i s a string or 305 * instance of a class that implements the operator <i>==</i> unless the key i s a string or
1168 * integer. 306 * integer.
1169 */ 307 */
1170 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU ALS = const CompileTimeErrorCode.con1('CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_ EQUALS', 21, "The constant map entry key expression type '%s' cannot override th e == operator"); 308 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU ALS = const CompileTimeErrorCode.con1('CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_ EQUALS', 22, "The constant map entry key expression type '%s' cannot override th e == operator");
1171 309
1172 /** 310 /**
1173 * 5 Variables: A constant variable must be initialized to a compile-time cons tant (12.1) or a 311 * 5 Variables: A constant variable must be initialized to a compile-time cons tant (12.1) or a
1174 * compile-time error occurs. 312 * compile-time error occurs.
1175 * 313 *
1176 * @param name the name of the uninitialized final variable 314 * @param name the name of the uninitialized final variable
1177 */ 315 */
1178 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = const CompileTimeErr orCode.con1('CONST_NOT_INITIALIZED', 22, "The const variable '%s' must be initia lized"); 316 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = const CompileTimeErr orCode.con1('CONST_NOT_INITIALIZED', 23, "The const variable '%s' must be initia lized");
1179 317
1180 /** 318 /**
1181 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, where e, e1 and e2 319 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, where e, e1 and e2
1182 * are constant expressions that evaluate to a boolean value. 320 * are constant expressions that evaluate to a boolean value.
1183 */ 321 */
1184 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = const CompileTimeErro rCode.con1('CONST_EVAL_TYPE_BOOL', 23, "An expression of type 'bool' was expecte d"); 322 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = const CompileTimeErro rCode.con1('CONST_EVAL_TYPE_BOOL', 24, "An expression of type 'bool' was expecte d");
1185 323
1186 /** 324 /**
1187 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where e1 and e2 are 325 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where e1 and e2 are
1188 * constant expressions that evaluate to a numeric, string or boolean value or to null. 326 * constant expressions that evaluate to a numeric, string or boolean value or to null.
1189 */ 327 */
1190 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = const Comp ileTimeErrorCode.con1('CONST_EVAL_TYPE_BOOL_NUM_STRING', 24, "An expression of t ype 'bool', 'num', 'String' or 'null' was expected"); 328 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = const Comp ileTimeErrorCode.con1('CONST_EVAL_TYPE_BOOL_NUM_STRING', 25, "An expression of t ype 'bool', 'num', 'String' or 'null' was expected");
1191 329
1192 /** 330 /**
1193 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, e1 | e2, e1 >> e2 or e1 331 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, e1 | e2, e1 >> e2 or e1
1194 * << e2, where e, e1 and e2 are constant expressions that evaluate to an inte ger value or to 332 * << e2, where e, e1 and e2 are constant expressions that evaluate to an inte ger value or to
1195 * null. 333 * null.
1196 */ 334 */
1197 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = const CompileTimeError Code.con1('CONST_EVAL_TYPE_INT', 25, "An expression of type 'int' was expected") ; 335 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = const CompileTimeError Code.con1('CONST_EVAL_TYPE_INT', 26, "An expression of type 'int' was expected") ;
1198 336
1199 /** 337 /**
1200 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * e2, e1 / e2, e1 ~/ 338 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * e2, e1 / e2, e1 ~/
1201 * e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e, e1 and e2 are constant 339 * e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e, e1 and e2 are constant
1202 * expressions that evaluate to a numeric value or to null.. 340 * expressions that evaluate to a numeric value or to null..
1203 */ 341 */
1204 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = const CompileTimeError Code.con1('CONST_EVAL_TYPE_NUM', 26, "An expression of type 'num' was expected") ; 342 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = const CompileTimeError Code.con1('CONST_EVAL_TYPE_NUM', 27, "An expression of type 'num' was expected") ;
1205 343
1206 /** 344 /**
1207 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 345 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
1208 * uncaught exception being thrown. 346 * uncaught exception being thrown.
1209 */ 347 */
1210 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = const CompileT imeErrorCode.con1('CONST_EVAL_THROWS_EXCEPTION', 27, "Evaluation of this constan t expression causes exception"); 348 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = const CompileT imeErrorCode.con1('CONST_EVAL_THROWS_EXCEPTION', 28, "Evaluation of this constan t expression causes exception");
1211 349
1212 /** 350 /**
1213 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 351 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
1214 * uncaught exception being thrown. 352 * uncaught exception being thrown.
1215 */ 353 */
1216 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = const CompileTimeE rrorCode.con1('CONST_EVAL_THROWS_IDBZE', 28, "Evaluation of this constant expres sion throws IntegerDivisionByZeroException"); 354 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = const CompileTimeE rrorCode.con1('CONST_EVAL_THROWS_IDBZE', 29, "Evaluation of this constant expres sion throws IntegerDivisionByZeroException");
1217 355
1218 /** 356 /**
1219 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>, & hellip;, 357 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>, & hellip;,
1220 * U<sub>m</sub>&gt;</i>, let <i>R = S</i>; It is a compile time error if <i>S </i> is not a 358 * U<sub>m</sub>&gt;</i>, let <i>R = S</i>; It is a compile time error if <i>S </i> is not a
1221 * generic type with <i>m</i> type parameters. 359 * generic type with <i>m</i> type parameters.
1222 * 360 *
1223 * @param typeName the name of the type being referenced (<i>S</i>) 361 * @param typeName the name of the type being referenced (<i>S</i>)
1224 * @param parameterCount the number of type parameters that were declared 362 * @param parameterCount the number of type parameters that were declared
1225 * @param argumentCount the number of type arguments provided 363 * @param argumentCount the number of type arguments provided
1226 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS 364 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS
1227 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS 365 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS
1228 */ 366 */
1229 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = const C ompileTimeErrorCode.con1('CONST_WITH_INVALID_TYPE_PARAMETERS', 29, "The type '%s ' is declared with %d type parameters, but %d type arguments were given"); 367 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = const C ompileTimeErrorCode.con1('CONST_WITH_INVALID_TYPE_PARAMETERS', 30, "The type '%s ' is declared with %d type parameters, but %d type arguments were given");
1230 368
1231 /** 369 /**
1232 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, &hellip ;, a<sub>n</sub>, 370 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, &hellip ;, a<sub>n</sub>,
1233 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a 371 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a
1234 * compile-time error if the type <i>T</i> does not declare a constant constru ctor with the same 372 * compile-time error if the type <i>T</i> does not declare a constant constru ctor with the same
1235 * name as the declaration of <i>T</i>. 373 * name as the declaration of <i>T</i>.
1236 */ 374 */
1237 static const CompileTimeErrorCode CONST_WITH_NON_CONST = const CompileTimeErro rCode.con1('CONST_WITH_NON_CONST', 30, "The constructor being called is not a 'c onst' constructor"); 375 static const CompileTimeErrorCode CONST_WITH_NON_CONST = const CompileTimeErro rCode.con1('CONST_WITH_NON_CONST', 31, "The constructor being called is not a 'c onst' constructor");
1238 376
1239 /** 377 /**
1240 * 12.11.2 Const: In all of the above cases, it is a compile-time error if <i> a<sub>i</sub>, 1 378 * 12.11.2 Const: In all of the above cases, it is a compile-time error if <i> a<sub>i</sub>, 1
1241 * &lt;= i &lt;= n + k</i>, is not a compile-time constant expression. 379 * &lt;= i &lt;= n + k</i>, is not a compile-time constant expression.
1242 */ 380 */
1243 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = const Com pileTimeErrorCode.con1('CONST_WITH_NON_CONSTANT_ARGUMENT', 31, "Arguments of a c onstant creation must be constant expressions"); 381 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = const Com pileTimeErrorCode.con1('CONST_WITH_NON_CONSTANT_ARGUMENT', 32, "Arguments of a c onstant creation must be constant expressions");
1244 382
1245 /** 383 /**
1246 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access ible in the current 384 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access ible in the current
1247 * scope, optionally followed by type arguments. 385 * scope, optionally followed by type arguments.
1248 * 386 *
1249 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, &hel lip;, a<sub>n</sub>, 387 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, &hel lip;, a<sub>n</sub>,
1250 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip; x<sub>n+k</sub>: a<sub>n+k</sub> )</i> it is a 388 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip; x<sub>n+k</sub>: a<sub>n+k</sub> )</i> it is a
1251 * compile-time error if <i>T</i> is not a class accessible in the current sco pe, optionally 389 * compile-time error if <i>T</i> is not a class accessible in the current sco pe, optionally
1252 * followed by type arguments. 390 * followed by type arguments.
1253 * 391 *
1254 * @param name the name of the non-type element 392 * @param name the name of the non-type element
1255 */ 393 */
1256 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = const CompileTimeError Code.con1('CONST_WITH_NON_TYPE', 32, "The name '%s' is not a class"); 394 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = const CompileTimeError Code.con1('CONST_WITH_NON_TYPE', 33, "The name '%s' is not a class");
1257 395
1258 /** 396 /**
1259 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type par ameters. 397 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type par ameters.
1260 */ 398 */
1261 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = const CompileTi meErrorCode.con1('CONST_WITH_TYPE_PARAMETERS', 33, "The constant creation cannot use a type parameter"); 399 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = const CompileTi meErrorCode.con1('CONST_WITH_TYPE_PARAMETERS', 34, "The constant creation cannot use a type parameter");
1262 400
1263 /** 401 /**
1264 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant 402 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
1265 * constructor declared by the type <i>T</i>. 403 * constructor declared by the type <i>T</i>.
1266 * 404 *
1267 * @param typeName the name of the type 405 * @param typeName the name of the type
1268 * @param constructorName the name of the requested constant constructor 406 * @param constructorName the name of the requested constant constructor
1269 */ 407 */
1270 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = const Com pileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR', 34, "The class '%s' d oes not have a constant constructor '%s'"); 408 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = const Com pileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR', 35, "The class '%s' d oes not have a constant constructor '%s'");
1271 409
1272 /** 410 /**
1273 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant 411 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
1274 * constructor declared by the type <i>T</i>. 412 * constructor declared by the type <i>T</i>.
1275 * 413 *
1276 * @param typeName the name of the type 414 * @param typeName the name of the type
1277 */ 415 */
1278 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = c onst CompileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 35, " The class '%s' does not have a default constant constructor"); 416 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = c onst CompileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 36, " The class '%s' does not have a default constant constructor");
1279 417
1280 /** 418 /**
1281 * 15.3.1 Typedef: It is a compile-time error if any default values are specif ied in the signature 419 * 15.3.1 Typedef: It is a compile-time error if any default values are specif ied in the signature
1282 * of a function type alias. 420 * of a function type alias.
1283 */ 421 */
1284 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 36, "Default values aren't allowed in typedefs"); 422 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 37, "Default values aren't allowed in typedefs");
1285 423
1286 /** 424 /**
1287 * 6.2.1 Required Formals: By means of a function signature that names the par ameter and describes 425 * 6.2.1 Required Formals: By means of a function signature that names the par ameter and describes
1288 * its type as a function type. It is a compile-time error if any default valu es are specified in 426 * its type as a function type. It is a compile-time error if any default valu es are specified in
1289 * the signature of such a function type. 427 * the signature of such a function type.
1290 */ 428 */
1291 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', 37, "Default values aren't allowed in function type parameters"); 429 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', 38, "Default values aren't allowed in function type parameters");
1292 430
1293 /** 431 /**
1294 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly specifie s a default value 432 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly specifie s a default value
1295 * for an optional parameter. 433 * for an optional parameter.
1296 */ 434 */
1297 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU CTOR = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CON STRUCTOR', 38, "Default values aren't allowed in factory constructors that redir ect to another constructor"); 435 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU CTOR = const CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CON STRUCTOR', 39, "Default values aren't allowed in factory constructors that redir ect to another constructor");
1298 436
1299 /** 437 /**
1300 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name 438 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name
1301 * declared in the same scope. 439 * declared in the same scope.
1302 */ 440 */
1303 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = const Compil eTimeErrorCode.con1('DUPLICATE_CONSTRUCTOR_DEFAULT', 39, "The default constructo r is already defined"); 441 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = const Compil eTimeErrorCode.con1('DUPLICATE_CONSTRUCTOR_DEFAULT', 40, "The default constructo r is already defined");
1304 442
1305 /** 443 /**
1306 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name 444 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name
1307 * declared in the same scope. 445 * declared in the same scope.
1308 * 446 *
1309 * @param duplicateName the name of the duplicate entity 447 * @param duplicateName the name of the duplicate entity
1310 */ 448 */
1311 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = const CompileTi meErrorCode.con1('DUPLICATE_CONSTRUCTOR_NAME', 40, "The constructor with name '% s' is already defined"); 449 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = const CompileTi meErrorCode.con1('DUPLICATE_CONSTRUCTOR_NAME', 41, "The constructor with name '% s' is already defined");
1312 450
1313 /** 451 /**
1314 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name 452 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi th the same name
1315 * declared in the same scope. 453 * declared in the same scope.
1316 * 454 *
1317 * 7 Classes: It is a compile-time error if a class declares two members of th e same name. 455 * 7 Classes: It is a compile-time error if a class declares two members of th e same name.
1318 * 456 *
1319 * 7 Classes: It is a compile-time error if a class has an instance member and a static member 457 * 7 Classes: It is a compile-time error if a class has an instance member and a static member
1320 * with the same name. 458 * with the same name.
1321 * 459 *
1322 * @param duplicateName the name of the duplicate entity 460 * @param duplicateName the name of the duplicate entity
1323 */ 461 */
1324 static const CompileTimeErrorCode DUPLICATE_DEFINITION = const CompileTimeErro rCode.con1('DUPLICATE_DEFINITION', 41, "The name '%s' is already defined"); 462 static const CompileTimeErrorCode DUPLICATE_DEFINITION = const CompileTimeErro rCode.con1('DUPLICATE_DEFINITION', 42, "The name '%s' is already defined");
1325 463
1326 /** 464 /**
1327 * 7. Classes: It is a compile-time error if a class has an instance member an d a static member 465 * 7. Classes: It is a compile-time error if a class has an instance member an d a static member
1328 * with the same name. 466 * with the same name.
1329 * 467 *
1330 * This covers the additional duplicate definition cases where inheritance has to be considered. 468 * This covers the additional duplicate definition cases where inheritance has to be considered.
1331 * 469 *
1332 * @param className the name of the class that has conflicting instance/static members 470 * @param className the name of the class that has conflicting instance/static members
1333 * @param name the name of the conflicting members 471 * @param name the name of the conflicting members
1334 * @see #DUPLICATE_DEFINITION 472 * @see #DUPLICATE_DEFINITION
1335 */ 473 */
1336 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = const Com pileTimeErrorCode.con1('DUPLICATE_DEFINITION_INHERITANCE', 42, "The name '%s' is already defined in '%s'"); 474 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = const Com pileTimeErrorCode.con1('DUPLICATE_DEFINITION_INHERITANCE', 43, "The name '%s' is already defined in '%s'");
1337 475
1338 /** 476 /**
1339 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub> i</sub> = 477 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub> i</sub> =
1340 * q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the label for a named 478 * q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the label for a named
1341 * argument]. 479 * argument].
1342 */ 480 */
1343 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = const CompileTime ErrorCode.con1('DUPLICATE_NAMED_ARGUMENT', 43, "The argument for the named param eter '%s' was already specified"); 481 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = const CompileTime ErrorCode.con1('DUPLICATE_NAMED_ARGUMENT', 44, "The argument for the named param eter '%s' was already specified");
1344 482
1345 /** 483 /**
1346 * SDK implementation libraries can be exported only by other SDK libraries. 484 * SDK implementation libraries can be exported only by other SDK libraries.
1347 * 485 *
1348 * @param uri the uri pointing to a library 486 * @param uri the uri pointing to a library
1349 */ 487 */
1350 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = const CompileTimeE rrorCode.con1('EXPORT_INTERNAL_LIBRARY', 44, "The library '%s' is internal and c annot be exported"); 488 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = const CompileTimeE rrorCode.con1('EXPORT_INTERNAL_LIBRARY', 45, "The library '%s' is internal and c annot be exported");
1351 489
1352 /** 490 /**
1353 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is 491 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is
1354 * not a library declaration. 492 * not a library declaration.
1355 * 493 *
1356 * @param uri the uri pointing to a non-library declaration 494 * @param uri the uri pointing to a non-library declaration
1357 */ 495 */
1358 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = const CompileTimeErr orCode.con1('EXPORT_OF_NON_LIBRARY', 45, "The exported library '%s' must not hav e a part-of directive"); 496 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = const CompileTimeErr orCode.con1('EXPORT_OF_NON_LIBRARY', 46, "The exported library '%s' must not hav e a part-of directive");
1359 497
1360 /** 498 /**
1361 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla ss <i>C</i> includes 499 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla ss <i>C</i> includes
1362 * a type expression that does not denote a class available in the lexical sco pe of <i>C</i>. 500 * a type expression that does not denote a class available in the lexical sco pe of <i>C</i>.
1363 * 501 *
1364 * @param typeName the name of the superclass that was not found 502 * @param typeName the name of the superclass that was not found
1365 */ 503 */
1366 static const CompileTimeErrorCode EXTENDS_NON_CLASS = const CompileTimeErrorCo de.con1('EXTENDS_NON_CLASS', 46, "Classes can only extend other classes"); 504 static const CompileTimeErrorCode EXTENDS_NON_CLASS = const CompileTimeErrorCo de.con1('EXTENDS_NON_CLASS', 47, "Classes can only extend other classes");
1367 505
1368 /** 506 /**
1369 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null. 507 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null.
1370 * 508 *
1371 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int. 509 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int.
1372 * 510 *
1373 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double. 511 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double.
1374 * 512 *
1375 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to 513 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to
1376 * attempt to extend or implement num. 514 * attempt to extend or implement num.
1377 * 515 *
1378 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool. 516 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool.
1379 * 517 *
1380 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String. 518 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String.
1381 * 519 *
1382 * @param typeName the name of the type that cannot be extended 520 * @param typeName the name of the type that cannot be extended
1383 * @see #IMPLEMENTS_DISALLOWED_CLASS 521 * @see #IMPLEMENTS_DISALLOWED_CLASS
1384 */ 522 */
1385 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = const CompileTime ErrorCode.con1('EXTENDS_DISALLOWED_CLASS', 47, "Classes cannot extend '%s'"); 523 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = const CompileTime ErrorCode.con1('EXTENDS_DISALLOWED_CLASS', 48, "Classes cannot extend '%s'");
524
525 /**
526 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla ss <i>C</i> includes
527 * a deferred type expression.
528 *
529 * @param typeName the name of the type that cannot be extended
530 * @see #IMPLEMENTS_DEFERRED_CLASS
531 * @see #MIXIN_DEFERRED_CLASS
532 */
533 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = const CompileTimeEr rorCode.con1('EXTENDS_DEFERRED_CLASS', 49, "This class cannot extend the deferre d class '%s'");
1386 534
1387 /** 535 /**
1388 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt; h</ i> or if <i>m &gt; 536 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt; h</ i> or if <i>m &gt;
1389 * n</i>. 537 * n</i>.
1390 * 538 *
1391 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 539 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
1392 * uncaught exception being thrown. 540 * uncaught exception being thrown.
1393 * 541 *
1394 * @param requiredCount the maximum number of positional arguments 542 * @param requiredCount the maximum number of positional arguments
1395 * @param argumentCount the actual number of positional arguments given 543 * @param argumentCount the actual number of positional arguments given
1396 */ 544 */
1397 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = const CompileTi meErrorCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 48, "%d positional arguments expe cted, but %d found"); 545 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = const CompileTi meErrorCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 50, "%d positional arguments expe cted, but %d found");
1398 546
1399 /** 547 /**
1400 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time 548 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
1401 * error if more than one initializer corresponding to a given instance variab le appears in 549 * error if more than one initializer corresponding to a given instance variab le appears in
1402 * <i>k</i>'s list. 550 * <i>k</i>'s list.
1403 */ 551 */
1404 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = const CompileTimeErrorCode.con1('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 4 9, "The field '%s' cannot be initialized twice in the same constructor"); 552 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = const CompileTimeErrorCode.con1('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 5 1, "The field '%s' cannot be initialized twice in the same constructor");
1405 553
1406 /** 554 /**
1407 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time 555 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
1408 * error if <i>k</i>'s initializer list contains an initializer for a variable that is initialized 556 * error if <i>k</i>'s initializer list contains an initializer for a variable that is initialized
1409 * by means of an initializing formal of <i>k</i>. 557 * by means of an initializing formal of <i>k</i>.
1410 */ 558 */
1411 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ ER = const CompileTimeErrorCode.con1('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIAL IZER', 50, "Fields cannot be initialized in both the parameter list and the init ializers"); 559 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ ER = const CompileTimeErrorCode.con1('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIAL IZER', 52, "Fields cannot be initialized in both the parameter list and the init ializers");
1412 560
1413 /** 561 /**
1414 * 5 Variables: It is a compile-time error if a final instance variable that h as is initialized by 562 * 5 Variables: It is a compile-time error if a final instance variable that h as is initialized by
1415 * means of an initializing formal of a constructor is also initialized elsewh ere in the same 563 * means of an initializing formal of a constructor is also initialized elsewh ere in the same
1416 * constructor. 564 * constructor.
1417 * 565 *
1418 * @param name the name of the field in question 566 * @param name the name of the field in question
1419 */ 567 */
1420 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = const Com pileTimeErrorCode.con1('FINAL_INITIALIZED_MULTIPLE_TIMES', 51, "'%s' is a final field and so can only be set once"); 568 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = const Com pileTimeErrorCode.con1('FINAL_INITIALIZED_MULTIPLE_TIMES', 53, "'%s' is a final field and so can only be set once");
1421 569
1422 /** 570 /**
1423 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by 571 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by
1424 * a function other than a non-redirecting generative constructor. 572 * a function other than a non-redirecting generative constructor.
1425 */ 573 */
1426 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = cons t CompileTimeErrorCode.con1('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 52, "Initia lizing formal fields cannot be used in factory constructors"); 574 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = cons t CompileTimeErrorCode.con1('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 54, "Initia lizing formal fields cannot be used in factory constructors");
1427 575
1428 /** 576 /**
1429 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by 577 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by
1430 * a function other than a non-redirecting generative constructor. 578 * a function other than a non-redirecting generative constructor.
1431 */ 579 */
1432 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = cons t CompileTimeErrorCode.con1('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 53, "Initia lizing formal fields can only be used in constructors"); 580 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = cons t CompileTimeErrorCode.con1('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 55, "Initia lizing formal fields can only be used in constructors");
1433 581
1434 /** 582 /**
1435 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its 583 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
1436 * only action is to invoke another generative constructor. 584 * only action is to invoke another generative constructor.
1437 * 585 *
1438 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by 586 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin g formal is used by
1439 * a function other than a non-redirecting generative constructor. 587 * a function other than a non-redirecting generative constructor.
1440 */ 588 */
1441 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = const CompileTimeErrorCode.con1('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 54, "The redirecting constructor cannot have a field initializer"); 589 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = const CompileTimeErrorCode.con1('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 56, "The redirecting constructor cannot have a field initializer");
1442 590
1443 /** 591 /**
1444 * 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same 592 * 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
1445 * name. 593 * name.
1446 * 594 *
1447 * @param name the conflicting name of the getter and method 595 * @param name the conflicting name of the getter and method
1448 */ 596 */
1449 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = const Com pileTimeErrorCode.con1('GETTER_AND_METHOD_WITH_SAME_NAME', 55, "'%s' cannot be u sed to name a getter, there is already a method with the same name"); 597 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = const Com pileTimeErrorCode.con1('GETTER_AND_METHOD_WITH_SAME_NAME', 57, "'%s' cannot be u sed to name a getter, there is already a method with the same name");
598
599 /**
600 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o f a class <i>C</i>
601 * specifies a malformed type or deferred type as a superinterface.
602 *
603 * @param typeName the name of the type that cannot be extended
604 * @see #EXTENDS_DEFERRED_CLASS
605 * @see #MIXIN_DEFERRED_CLASS
606 */
607 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = const CompileTim eErrorCode.con1('IMPLEMENTS_DEFERRED_CLASS', 58, "This class cannot implement th e deferred class '%s'");
1450 608
1451 /** 609 /**
1452 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null. 610 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null.
1453 * 611 *
1454 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int. 612 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int.
1455 * 613 *
1456 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double. 614 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double.
1457 * 615 *
1458 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to 616 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to
1459 * attempt to extend or implement num. 617 * attempt to extend or implement num.
1460 * 618 *
1461 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool. 619 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool.
1462 * 620 *
1463 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String. 621 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String.
1464 * 622 *
1465 * @param typeName the name of the type that cannot be implemented 623 * @param typeName the name of the type that cannot be implemented
1466 * @see #EXTENDS_DISALLOWED_CLASS 624 * @see #EXTENDS_DISALLOWED_CLASS
1467 */ 625 */
1468 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = const CompileT imeErrorCode.con1('IMPLEMENTS_DISALLOWED_CLASS', 56, "Classes cannot implement ' %s'"); 626 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = const CompileT imeErrorCode.con1('IMPLEMENTS_DISALLOWED_CLASS', 59, "Classes cannot implement ' %s'");
1469 627
1470 /** 628 /**
1471 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o f a class includes 629 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o f a class includes
1472 * type dynamic. 630 * type dynamic.
1473 */ 631 */
1474 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = const CompileTimeErrorC ode.con1('IMPLEMENTS_DYNAMIC', 57, "Classes cannot implement 'dynamic'"); 632 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = const CompileTimeErrorC ode.con1('IMPLEMENTS_DYNAMIC', 60, "Classes cannot implement 'dynamic'");
1475 633
1476 /** 634 /**
1477 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o f a class <i>C</i> 635 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o f a class <i>C</i>
1478 * includes a type expression that does not denote a class available in the le xical scope of 636 * includes a type expression that does not denote a class available in the le xical scope of
1479 * <i>C</i>. 637 * <i>C</i>.
1480 * 638 *
1481 * @param typeName the name of the interface that was not found 639 * @param typeName the name of the interface that was not found
1482 */ 640 */
1483 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = const CompileTimeErro rCode.con1('IMPLEMENTS_NON_CLASS', 58, "Classes can only implement other classes "); 641 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = const CompileTimeErro rCode.con1('IMPLEMENTS_NON_CLASS', 61, "Classes can only implement other classes ");
1484 642
1485 /** 643 /**
1486 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears more than once in 644 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears more than once in
1487 * the implements clause of a class. 645 * the implements clause of a class.
1488 * 646 *
1489 * @param className the name of the class that is implemented more than once 647 * @param className the name of the class that is implemented more than once
1490 */ 648 */
1491 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = const CompileTimeError Code.con1('IMPLEMENTS_REPEATED', 59, "'%s' can only be implemented once"); 649 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = const CompileTimeError Code.con1('IMPLEMENTS_REPEATED', 62, "'%s' can only be implemented once");
1492 650
1493 /** 651 /**
1494 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a cla ss <i>C</i> appears 652 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a cla ss <i>C</i> appears
1495 * in the implements clause of <i>C</i>. 653 * in the implements clause of <i>C</i>.
1496 * 654 *
1497 * @param className the name of the class that appears in both "extends" and " implements" clauses 655 * @param className the name of the class that appears in both "extends" and " implements" clauses
1498 */ 656 */
1499 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = const CompileTimeEr rorCode.con1('IMPLEMENTS_SUPER_CLASS', 60, "'%s' cannot be used in both 'extends ' and 'implements' clauses"); 657 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = const CompileTimeEr rorCode.con1('IMPLEMENTS_SUPER_CLASS', 63, "'%s' cannot be used in both 'extends ' and 'implements' clauses");
1500 658
1501 /** 659 /**
1502 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the right hand side of 660 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the right hand side of
1503 * an initializer. 661 * an initializer.
1504 * 662 *
1505 * 12.10 This: It is a compile-time error if this appears in a top-level funct ion or variable 663 * 12.10 This: It is a compile-time error if this appears in a top-level funct ion or variable
1506 * initializer, in a factory constructor, or in a static method or variable in itializer, or in the 664 * initializer, in a factory constructor, or in a static method or variable in itializer, or in the
1507 * initializer of an instance variable. 665 * initializer of an instance variable.
1508 * 666 *
1509 * @param name the name of the type in question 667 * @param name the name of the type in question
1510 */ 668 */
1511 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = con st CompileTimeErrorCode.con1('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', 61, "Only static members can be accessed in initializers"); 669 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = con st CompileTimeErrorCode.con1('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', 64, "Only static members can be accessed in initializers");
1512 670
1513 /** 671 /**
1514 * Speculative. 672 * Speculative.
1515 */ 673 *
1516 static const CompileTimeErrorCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const CompileTimeErrorCode.con1('IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', 6 2, "The library '%s' defines a top-level function named 'loadLibrary' and theref ore cannot be deferred"); 674 * TODO (jwren) Revisit to remove after we know for sure that this won't be in the Spec.
675 */
676 static const CompileTimeErrorCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const CompileTimeErrorCode.con1('IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', 6 5, "The library '%s' defines a top-level function named 'loadLibrary' and theref ore cannot be deferred");
1517 677
1518 /** 678 /**
1519 * SDK implementation libraries can be imported only by other SDK libraries. 679 * SDK implementation libraries can be imported only by other SDK libraries.
1520 * 680 *
1521 * @param uri the uri pointing to a library 681 * @param uri the uri pointing to a library
1522 */ 682 */
1523 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = const CompileTimeE rrorCode.con1('IMPORT_INTERNAL_LIBRARY', 63, "The library '%s' is internal and c annot be imported"); 683 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = const CompileTimeE rrorCode.con1('IMPORT_INTERNAL_LIBRARY', 66, "The library '%s' is internal and c annot be imported");
1524 684
1525 /** 685 /**
1526 * 14.1 Imports: It is a compile-time error if the compilation unit found at t he specified URI is 686 * 14.1 Imports: It is a compile-time error if the specified URI of an immedia te import does not
1527 * not a library declaration. 687 * refer to a library declaration.
1528 * 688 *
1529 * @param uri the uri pointing to a non-library declaration 689 * @param uri the uri pointing to a non-library declaration
1530 */ 690 * @see StaticWarningCode#IMPORT_OF_NON_LIBRARY
1531 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = const CompileTimeErr orCode.con1('IMPORT_OF_NON_LIBRARY', 64, "The imported library '%s' must not hav e a part-of directive"); 691 */
692 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = const CompileTimeErr orCode.con1('IMPORT_OF_NON_LIBRARY', 67, "The imported library '%s' must not hav e a part-of directive");
1532 693
1533 /** 694 /**
1534 * 13.9 Switch: It is a compile-time error if values of the expressions <i>e<s ub>k</sub></i> are 695 * 13.9 Switch: It is a compile-time error if values of the expressions <i>e<s ub>k</sub></i> are
1535 * not instances of the same class <i>C</i>, for all <i>1 &lt;= k &lt;= n</i>. 696 * not instances of the same class <i>C</i>, for all <i>1 &lt;= k &lt;= n</i>.
1536 * 697 *
1537 * @param expressionSource the expression source code that is the unexpected t ype 698 * @param expressionSource the expression source code that is the unexpected t ype
1538 * @param expectedType the name of the expected type 699 * @param expectedType the name of the expected type
1539 */ 700 */
1540 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = const C ompileTimeErrorCode.con1('INCONSISTENT_CASE_EXPRESSION_TYPES', 65, "Case express ions must have the same types, '%s' is not a '%s'"); 701 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = const C ompileTimeErrorCode.con1('INCONSISTENT_CASE_EXPRESSION_TYPES', 68, "Case express ions must have the same types, '%s' is not a '%s'");
1541 702
1542 /** 703 /**
1543 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time 704 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
1544 * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an 705 * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
1545 * instance variable declared in the immediately surrounding class. 706 * instance variable declared in the immediately surrounding class.
1546 * 707 *
1547 * @param id the name of the initializing formal that is not an instance varia ble in the 708 * @param id the name of the initializing formal that is not an instance varia ble in the
1548 * immediately enclosing class 709 * immediately enclosing class
1549 * @see #INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD 710 * @see #INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD
1550 */ 711 */
1551 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = const C ompileTimeErrorCode.con1('INITIALIZER_FOR_NON_EXISTANT_FIELD', 66, "'%s' is not a variable in the enclosing class"); 712 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = const C ompileTimeErrorCode.con1('INITIALIZER_FOR_NON_EXISTANT_FIELD', 69, "'%s' is not a variable in the enclosing class");
1552 713
1553 /** 714 /**
1554 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time 715 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
1555 * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an 716 * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
1556 * instance variable declared in the immediately surrounding class. 717 * instance variable declared in the immediately surrounding class.
1557 * 718 *
1558 * @param id the name of the initializing formal that is a static variable in the immediately 719 * @param id the name of the initializing formal that is a static variable in the immediately
1559 * enclosing class 720 * enclosing class
1560 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD 721 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
1561 */ 722 */
1562 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = const Compile TimeErrorCode.con1('INITIALIZER_FOR_STATIC_FIELD', 67, "'%s' is a static variabl e in the enclosing class, variables initialized in a constructor cannot be stati c"); 723 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = const Compile TimeErrorCode.con1('INITIALIZER_FOR_STATIC_FIELD', 70, "'%s' is a static variabl e in the enclosing class, variables initialized in a constructor cannot be stati c");
1563 724
1564 /** 725 /**
1565 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this. id</i>. It is a 726 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this. id</i>. It is a
1566 * compile-time error if <i>id</i> is not the name of an instance variable of the immediately 727 * compile-time error if <i>id</i> is not the name of an instance variable of the immediately
1567 * enclosing class. 728 * enclosing class.
1568 * 729 *
1569 * @param id the name of the initializing formal that is not an instance varia ble in the 730 * @param id the name of the initializing formal that is not an instance varia ble in the
1570 * immediately enclosing class 731 * immediately enclosing class
1571 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD 732 * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
1572 * @see #INITIALIZER_FOR_NON_EXISTANT_FIELD 733 * @see #INITIALIZER_FOR_NON_EXISTANT_FIELD
1573 */ 734 */
1574 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD = const CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 6 8, "'%s' is not a variable in the enclosing class"); 735 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD = const CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 7 1, "'%s' is not a variable in the enclosing class");
1575 736
1576 /** 737 /**
1577 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this. id</i>. It is a 738 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this. id</i>. It is a
1578 * compile-time error if <i>id</i> is not the name of an instance variable of the immediately 739 * compile-time error if <i>id</i> is not the name of an instance variable of the immediately
1579 * enclosing class. 740 * enclosing class.
1580 * 741 *
1581 * @param id the name of the initializing formal that is a static variable in the immediately 742 * @param id the name of the initializing formal that is a static variable in the immediately
1582 * enclosing class 743 * enclosing class
1583 * @see #INITIALIZER_FOR_STATIC_FIELD 744 * @see #INITIALIZER_FOR_STATIC_FIELD
1584 */ 745 */
1585 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = const CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 69, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static"); 746 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = const CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 72, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
1586 747
1587 /** 748 /**
1588 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property extr action 749 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property extr action
1589 * <b>this</b>.<i>id</i>. 750 * <b>this</b>.<i>id</i>.
1590 */ 751 */
1591 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = const C ompileTimeErrorCode.con1('INSTANCE_MEMBER_ACCESS_FROM_STATIC', 70, "Instance mem ber cannot be accessed from static method"); 752 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = const C ompileTimeErrorCode.con1('INSTANCE_MEMBER_ACCESS_FROM_STATIC', 73, "Instance mem ber cannot be accessed from static method");
1592 753
1593 /** 754 /**
1594 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the 755 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the
1595 * character @, followed by a constant expression that must be either a refere nce to a 756 * character @, followed by a constant expression that must be either a refere nce to a
1596 * compile-time constant variable, or a call to a constant constructor. 757 * compile-time constant variable, or a call to a constant constructor.
1597 */ 758 */
1598 static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorC ode.con1('INVALID_ANNOTATION', 71, "Annotation can be only constant variable or constant constructor invocation"); 759 static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorC ode.con1('INVALID_ANNOTATION', 74, "Annotation can be only constant variable or constant constructor invocation");
1599 760
1600 /** 761 /**
1601 * TODO(brianwilkerson) Remove this when we have decided on how to report erro rs in compile-time 762 * TODO(brianwilkerson) Remove this when we have decided on how to report erro rs in compile-time
1602 * constants. Until then, this acts as a placeholder for more informative erro rs. 763 * constants. Until then, this acts as a placeholder for more informative erro rs.
1603 * 764 *
1604 * See TODOs in ConstantVisitor 765 * See TODOs in ConstantVisitor
1605 */ 766 */
1606 static const CompileTimeErrorCode INVALID_CONSTANT = const CompileTimeErrorCod e.con1('INVALID_CONSTANT', 72, "Invalid constant value"); 767 static const CompileTimeErrorCode INVALID_CONSTANT = const CompileTimeErrorCod e.con1('INVALID_CONSTANT', 75, "Invalid constant value");
1607 768
1608 /** 769 /**
1609 * 7.6 Constructors: It is a compile-time error if the name of a constructor i s not a constructor 770 * 7.6 Constructors: It is a compile-time error if the name of a constructor i s not a constructor
1610 * name. 771 * name.
1611 */ 772 */
1612 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = const CompileTime ErrorCode.con1('INVALID_CONSTRUCTOR_NAME', 73, "Invalid constructor name"); 773 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = const CompileTime ErrorCode.con1('INVALID_CONSTRUCTOR_NAME', 76, "Invalid constructor name");
1613 774
1614 /** 775 /**
1615 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of the immediately 776 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of the immediately
1616 * enclosing class. 777 * enclosing class.
1617 */ 778 */
1618 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = const Com pileTimeErrorCode.con1('INVALID_FACTORY_NAME_NOT_A_CLASS', 74, "The name of the immediately enclosing class expected"); 779 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = const Com pileTimeErrorCode.con1('INVALID_FACTORY_NAME_NOT_A_CLASS', 77, "The name of the immediately enclosing class expected");
1619 780
1620 /** 781 /**
1621 * 12.10 This: It is a compile-time error if this appears in a top-level funct ion or variable 782 * 12.10 This: It is a compile-time error if this appears in a top-level funct ion or variable
1622 * initializer, in a factory constructor, or in a static method or variable in itializer, or in the 783 * initializer, in a factory constructor, or in a static method or variable in itializer, or in the
1623 * initializer of an instance variable. 784 * initializer of an instance variable.
1624 */ 785 */
1625 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = const CompileTim eErrorCode.con1('INVALID_REFERENCE_TO_THIS', 75, "Invalid reference to 'this' ex pression"); 786 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = const CompileTim eErrorCode.con1('INVALID_REFERENCE_TO_THIS', 78, "Invalid reference to 'this' ex pression");
1626 787
1627 /** 788 /**
1628 * 12.6 Lists: It is a compile time error if the type argument of a constant l ist literal includes 789 * 12.6 Lists: It is a compile time error if the type argument of a constant l ist literal includes
1629 * a type parameter. 790 * a type parameter.
1630 * 791 *
1631 * @name the name of the type parameter 792 * @name the name of the type parameter
1632 */ 793 */
1633 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = const CompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 76, "Constant l ist literals cannot include a type parameter as a type argument, such as '%s'"); 794 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = const CompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 79, "Constant l ist literals cannot include a type parameter as a type argument, such as '%s'");
1634 795
1635 /** 796 /**
1636 * 12.7 Maps: It is a compile time error if the type arguments of a constant m ap literal include a 797 * 12.7 Maps: It is a compile time error if the type arguments of a constant m ap literal include a
1637 * type parameter. 798 * type parameter.
1638 * 799 *
1639 * @name the name of the type parameter 800 * @name the name of the type parameter
1640 */ 801 */
1641 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = const C ompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 77, "Constant map literals cannot include a type parameter as a type argument, such as '%s'"); 802 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = const C ompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 80, "Constant map literals cannot include a type parameter as a type argument, such as '%s'");
1642 803
1643 /** 804 /**
1644 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is 805 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is
1645 * not a library declaration. 806 * not a library declaration.
1646 * 807 *
1647 * 14.1 Imports: It is a compile-time error if the compilation unit found at t he specified URI is 808 * 14.1 Imports: It is a compile-time error if the compilation unit found at t he specified URI is
1648 * not a library declaration. 809 * not a library declaration.
1649 * 810 *
1650 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part 811 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
1651 * declaration. 812 * declaration.
1652 * 813 *
1653 * @param uri the URI that is invalid 814 * @param uri the URI that is invalid
1654 * @see #URI_DOES_NOT_EXIST 815 * @see #URI_DOES_NOT_EXIST
1655 */ 816 */
1656 static const CompileTimeErrorCode INVALID_URI = const CompileTimeErrorCode.con 1('INVALID_URI', 78, "Invalid URI syntax: '%s'"); 817 static const CompileTimeErrorCode INVALID_URI = const CompileTimeErrorCode.con 1('INVALID_URI', 81, "Invalid URI syntax: '%s'");
1657 818
1658 /** 819 /**
1659 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su b></i> exists within 820 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su b></i> exists within
1660 * the innermost function in which <i>s<sub>b</sub></i> occurs. 821 * the innermost function in which <i>s<sub>b</sub></i> occurs.
1661 * 822 *
1662 * 13.14 Continue: It is a compile-time error if no such statement or case cla use 823 * 13.14 Continue: It is a compile-time error if no such statement or case cla use
1663 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub >c</sub></i> occurs. 824 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub >c</sub></i> occurs.
1664 * 825 *
1665 * @param labelName the name of the unresolvable label 826 * @param labelName the name of the unresolvable label
1666 */ 827 */
1667 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = const CompileTimeErro rCode.con1('LABEL_IN_OUTER_SCOPE', 79, "Cannot reference label '%s' declared in an outer method"); 828 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = const CompileTimeErro rCode.con1('LABEL_IN_OUTER_SCOPE', 82, "Cannot reference label '%s' declared in an outer method");
1668 829
1669 /** 830 /**
1670 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su b></i> exists within 831 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su b></i> exists within
1671 * the innermost function in which <i>s<sub>b</sub></i> occurs. 832 * the innermost function in which <i>s<sub>b</sub></i> occurs.
1672 * 833 *
1673 * 13.14 Continue: It is a compile-time error if no such statement or case cla use 834 * 13.14 Continue: It is a compile-time error if no such statement or case cla use
1674 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub >c</sub></i> occurs. 835 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub >c</sub></i> occurs.
1675 * 836 *
1676 * @param labelName the name of the unresolvable label 837 * @param labelName the name of the unresolvable label
1677 */ 838 */
1678 static const CompileTimeErrorCode LABEL_UNDEFINED = const CompileTimeErrorCode .con1('LABEL_UNDEFINED', 80, "Cannot reference undefined label '%s'"); 839 static const CompileTimeErrorCode LABEL_UNDEFINED = const CompileTimeErrorCode .con1('LABEL_UNDEFINED', 83, "Cannot reference undefined label '%s'");
1679 840
1680 /** 841 /**
1681 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> ... 842 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> ...
1682 * <i>e<sub>n</sub></i>] is evaluated as follows: 843 * <i>e<sub>n</sub></i>] is evaluated as follows:
1683 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument 844 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument
1684 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i> 845 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i>
1685 * 846 *
1686 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 847 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
1687 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 848 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
1688 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 849 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
1689 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 850 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
1690 * j &lt;= m</i>. 851 * j &lt;= m</i>.
1691 */ 852 */
1692 static const CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Com pileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 81, "The element type '%s' cannot be assigned to the list type '%s'"); 853 static const CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Com pileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 84, "The element type '%s' cannot be assigned to the list type '%s'");
1693 854
1694 /** 855 /**
1695 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 856 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
1696 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows: 857 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows:
1697 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 858 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
1698 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 859 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
1699 * 860 *
1700 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 861 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
1701 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 862 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
1702 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 863 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
1703 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 864 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
1704 * j &lt;= m</i>. 865 * j &lt;= m</i>.
1705 */ 866 */
1706 static const CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const CompileT imeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 82, "The element type '%s' cann ot be assigned to the map key type '%s'"); 867 static const CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const CompileT imeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 85, "The element type '%s' cann ot be assigned to the map key type '%s'");
1707 868
1708 /** 869 /**
1709 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 870 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
1710 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows: 871 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows:
1711 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 872 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
1712 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 873 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
1713 * 874 *
1714 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 875 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
1715 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 876 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
1716 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 877 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
1717 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 878 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
1718 * j &lt;= m</i>. 879 * j &lt;= m</i>.
1719 */ 880 */
1720 static const CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const Compil eTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 83, "The element type '%s' cannot be assigned to the map value type '%s'"); 881 static const CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const Compil eTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 86, "The element type '%s' cannot be assigned to the map value type '%s'");
1721 882
1722 /** 883 /**
1723 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member with the same name 884 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member with the same name
1724 * as <i>C</i>. 885 * as <i>C</i>.
1725 */ 886 */
1726 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = const CompileTimeEr rorCode.con1('MEMBER_WITH_CLASS_NAME', 84, "Class members cannot have the same n ame as the enclosing class"); 887 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = const CompileTimeEr rorCode.con1('MEMBER_WITH_CLASS_NAME', 87, "Class members cannot have the same n ame as the enclosing class");
1727 888
1728 /** 889 /**
1729 * 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same 890 * 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
1730 * name. 891 * name.
1731 * 892 *
1732 * @param name the conflicting name of the getter and method 893 * @param name the conflicting name of the getter and method
1733 */ 894 */
1734 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = const Com pileTimeErrorCode.con1('METHOD_AND_GETTER_WITH_SAME_NAME', 85, "'%s' cannot be u sed to name a method, there is already a getter with the same name"); 895 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = const Com pileTimeErrorCode.con1('METHOD_AND_GETTER_WITH_SAME_NAME', 88, "'%s' cannot be u sed to name a method, there is already a getter with the same name");
1735 896
1736 /** 897 /**
1737 * 12.1 Constants: A constant expression is ... a constant list literal. 898 * 12.1 Constants: A constant expression is ... a constant list literal.
1738 */ 899 */
1739 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = const Compil eTimeErrorCode.con1('MISSING_CONST_IN_LIST_LITERAL', 86, "List literals must be prefixed with 'const' when used as a constant expression"); 900 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = const Compil eTimeErrorCode.con1('MISSING_CONST_IN_LIST_LITERAL', 89, "List literals must be prefixed with 'const' when used as a constant expression");
1740 901
1741 /** 902 /**
1742 * 12.1 Constants: A constant expression is ... a constant map literal. 903 * 12.1 Constants: A constant expression is ... a constant map literal.
1743 */ 904 */
1744 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = const Compile TimeErrorCode.con1('MISSING_CONST_IN_MAP_LITERAL', 87, "Map literals must be pre fixed with 'const' when used as a constant expression"); 905 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = const Compile TimeErrorCode.con1('MISSING_CONST_IN_MAP_LITERAL', 90, "Map literals must be pre fixed with 'const' when used as a constant expression");
1745 906
1746 /** 907 /**
1747 * 9 Mixins: It is a compile-time error if a declared or derived mixin explici tly declares a 908 * 9 Mixins: It is a compile-time error if a declared or derived mixin explici tly declares a
1748 * constructor. 909 * constructor.
1749 * 910 *
1750 * @param typeName the name of the mixin that is invalid 911 * @param typeName the name of the mixin that is invalid
1751 */ 912 */
1752 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = const CompileTi meErrorCode.con1('MIXIN_DECLARES_CONSTRUCTOR', 88, "The class '%s' cannot be use d as a mixin because it declares a constructor"); 913 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = const CompileTi meErrorCode.con1('MIXIN_DECLARES_CONSTRUCTOR', 91, "The class '%s' cannot be use d as a mixin because it declares a constructor");
914
915 /**
916 * 9.1 Mixin Application: It is a compile-time error if the with clause of a m ixin application
917 * <i>C</i> includes a deferred type expression.
918 *
919 * @param typeName the name of the type that cannot be extended
920 * @see #EXTENDS_DEFERRED_CLASS
921 * @see #IMPLEMENTS_DEFERRED_CLASS
922 */
923 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = const CompileTimeErro rCode.con1('MIXIN_DEFERRED_CLASS', 92, "This class cannot mixin the deferred cla ss '%s'");
1753 924
1754 /** 925 /**
1755 * 9 Mixins: It is a compile-time error if a mixin is derived from a class who se superclass is not 926 * 9 Mixins: It is a compile-time error if a mixin is derived from a class who se superclass is not
1756 * Object. 927 * Object.
1757 * 928 *
1758 * @param typeName the name of the mixin that is invalid 929 * @param typeName the name of the mixin that is invalid
1759 */ 930 */
1760 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = const Compi leTimeErrorCode.con1('MIXIN_INHERITS_FROM_NOT_OBJECT', 89, "The class '%s' canno t be used as a mixin because it extends a class other than Object"); 931 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = const Compi leTimeErrorCode.con1('MIXIN_INHERITS_FROM_NOT_OBJECT', 93, "The class '%s' canno t be used as a mixin because it extends a class other than Object");
1761 932
1762 /** 933 /**
1763 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null. 934 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i mplement Null.
1764 * 935 *
1765 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int. 936 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement int.
1766 * 937 *
1767 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double. 938 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o r implement double.
1768 * 939 *
1769 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to 940 * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to
1770 * attempt to extend or implement num. 941 * attempt to extend or implement num.
1771 * 942 *
1772 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool. 943 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool.
1773 * 944 *
1774 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String. 945 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o r implement String.
1775 * 946 *
1776 * @param typeName the name of the type that cannot be extended 947 * @param typeName the name of the type that cannot be extended
1777 * @see #IMPLEMENTS_DISALLOWED_CLASS 948 * @see #IMPLEMENTS_DISALLOWED_CLASS
1778 */ 949 */
1779 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = const CompileTim eErrorCode.con1('MIXIN_OF_DISALLOWED_CLASS', 90, "Classes cannot mixin '%s'"); 950 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = const CompileTim eErrorCode.con1('MIXIN_OF_DISALLOWED_CLASS', 94, "Classes cannot mixin '%s'");
1780 951
1781 /** 952 /**
1782 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not deno te a class or mixin 953 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not deno te a class or mixin
1783 * available in the immediately enclosing scope. 954 * available in the immediately enclosing scope.
1784 */ 955 */
1785 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = const CompileTimeErrorC ode.con1('MIXIN_OF_NON_CLASS', 91, "Classes can only mixin other classes"); 956 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = const CompileTimeErrorC ode.con1('MIXIN_OF_NON_CLASS', 95, "Classes can only mixin other classes");
1786 957
1787 /** 958 /**
1788 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers to super. 959 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers to super.
1789 */ 960 */
1790 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = const CompileTimeEr rorCode.con1('MIXIN_REFERENCES_SUPER', 92, "The class '%s' cannot be used as a m ixin because it references 'super'"); 961 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = const CompileTimeEr rorCode.con1('MIXIN_REFERENCES_SUPER', 96, "The class '%s' cannot be used as a m ixin because it references 'super'");
1791 962
1792 /** 963 /**
1793 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not deno te a class available 964 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not deno te a class available
1794 * in the immediately enclosing scope. 965 * in the immediately enclosing scope.
1795 */ 966 */
1796 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = const Comp ileTimeErrorCode.con1('MIXIN_WITH_NON_CLASS_SUPERCLASS', 93, "Mixin can only be applied to class"); 967 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = const Comp ileTimeErrorCode.con1('MIXIN_WITH_NON_CLASS_SUPERCLASS', 97, "Mixin can only be applied to class");
1797 968
1798 /** 969 /**
1799 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its 970 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
1800 * only action is to invoke another generative constructor. 971 * only action is to invoke another generative constructor.
1801 */ 972 */
1802 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = const CompileTimeErrorCode.con1('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS ', 94, "Constructor may have at most one 'this' redirection"); 973 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = const CompileTimeErrorCode.con1('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS ', 98, "Constructor may have at most one 'this' redirection");
1803 974
1804 /** 975 /**
1805 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Th en <i>k</i> may 976 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Th en <i>k</i> may
1806 * include at most one superinitializer in its initializer list or a compile t ime error occurs. 977 * include at most one superinitializer in its initializer list or a compile t ime error occurs.
1807 */ 978 */
1808 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = const CompileT imeErrorCode.con1('MULTIPLE_SUPER_INITIALIZERS', 95, "Constructor may have at mo st one 'super' initializer"); 979 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = const CompileT imeErrorCode.con1('MULTIPLE_SUPER_INITIALIZERS', 99, "Constructor may have at mo st one 'super' initializer");
1809 980
1810 /** 981 /**
1811 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the 982 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the
1812 * character @, followed by a constant expression that must be either a refere nce to a 983 * character @, followed by a constant expression that must be either a refere nce to a
1813 * compile-time constant variable, or a call to a constant constructor. 984 * compile-time constant variable, or a call to a constant constructor.
1814 */ 985 */
1815 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = const CompileTimeErrorCode.con1('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 96, "Annotation creation must have arguments"); 986 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = const CompileTimeErrorCode.con1('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 100, "Annotatio n creation must have arguments");
1816 987
1817 /** 988 /**
1818 * 7.6.1 Generative Constructors: If no superinitializer is provided, an impli cit superinitializer 989 * 7.6.1 Generative Constructors: If no superinitializer is provided, an impli cit superinitializer
1819 * of the form <b>super</b>() is added at the end of <i>k</i>'s initializer li st, unless the 990 * of the form <b>super</b>() is added at the end of <i>k</i>'s initializer li st, unless the
1820 * enclosing class is class <i>Object</i>. 991 * enclosing class is class <i>Object</i>.
1821 * 992 *
1822 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a 993 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a
1823 * generative constructor named <i>S</i> (respectively <i>S.id</i>) 994 * generative constructor named <i>S</i> (respectively <i>S.id</i>)
1824 */ 995 */
1825 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = cons t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', 97, "The cl ass '%s' does not have a default constructor"); 996 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = cons t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', 101, "The c lass '%s' does not have a default constructor");
1826 997
1827 /** 998 /**
1828 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it implicitly has a 999 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it implicitly has a
1829 * default constructor C() : <b>super<b>() {}, unless <i>C</i> is class <i>Obj ect</i>. 1000 * default constructor C() : <b>super<b>() {}, unless <i>C</i> is class <i>Obj ect</i>.
1830 * 1001 *
1831 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a 1002 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a
1832 * generative constructor named <i>S</i> (respectively <i>S.id</i>) 1003 * generative constructor named <i>S</i> (respectively <i>S.id</i>)
1833 */ 1004 */
1834 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = cons t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', 98, "The cl ass '%s' does not have a default constructor"); 1005 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = cons t CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', 102, "The c lass '%s' does not have a default constructor");
1835 1006
1836 /** 1007 /**
1837 * 13.2 Expression Statements: It is a compile-time error if a non-constant ma p literal that has 1008 * 13.2 Expression Statements: It is a compile-time error if a non-constant ma p literal that has
1838 * no explicit type arguments appears in a place where a statement is expected . 1009 * no explicit type arguments appears in a place where a statement is expected .
1839 */ 1010 */
1840 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = cons t CompileTimeErrorCode.con1('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 99, "A non- constant map literal without type arguments cannot be used as an expression stat ement"); 1011 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = cons t CompileTimeErrorCode.con1('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 103, "A non -constant map literal without type arguments cannot be used as an expression sta tement");
1841 1012
1842 /** 1013 /**
1843 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub >11</sub> &hellip; 1014 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub >11</sub> &hellip;
1844 * label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> &hellip; label<sub>n1 </sub> &hellip; 1015 * label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> &hellip; label<sub>n1 </sub> &hellip;
1845 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</s ub>}</i> or the form 1016 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</s ub>}</i> or the form
1846 * <i>switch (e) { label<sub>11</sub> &hellip; label<sub>1j1</sub> case e<sub> 1</sub>: 1017 * <i>switch (e) { label<sub>11</sub> &hellip; label<sub>1j1</sub> case e<sub> 1</sub>:
1847 * s<sub>1</sub> &hellip; label<sub>n1</sub> &hellip; label<sub>njn</sub> case e<sub>n</sub>: 1018 * s<sub>1</sub> &hellip; label<sub>n1</sub> &hellip; label<sub>njn</sub> case e<sub>n</sub>:
1848 * s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub> k</sub></i> are not 1019 * s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub> k</sub></i> are not
1849 * compile-time constants, for all <i>1 &lt;= k &lt;= n</i>. 1020 * compile-time constants, for all <i>1 &lt;= k &lt;= n</i>.
1850 */ 1021 */
1851 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = const Compile TimeErrorCode.con1('NON_CONSTANT_CASE_EXPRESSION', 100, "Case expressions must b e constant"); 1022 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = const Compile TimeErrorCode.con1('NON_CONSTANT_CASE_EXPRESSION', 104, "Case expressions must b e constant");
1852 1023
1853 /** 1024 /**
1854 * 6.2.2 Optional Formals: It is a compile-time error if the default value of an optional 1025 * 6.2.2 Optional Formals: It is a compile-time error if the default value of an optional
1855 * parameter is not a compile-time constant. 1026 * parameter is not a compile-time constant.
1856 */ 1027 */
1857 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = const CompileTi meErrorCode.con1('NON_CONSTANT_DEFAULT_VALUE', 101, "Default values of an option al parameter must be constant"); 1028 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = const CompileTi meErrorCode.con1('NON_CONSTANT_DEFAULT_VALUE', 105, "Default values of an option al parameter must be constant");
1858 1029
1859 /** 1030 /**
1860 * 12.6 Lists: It is a compile time error if an element of a constant list lit eral is not a 1031 * 12.6 Lists: It is a compile time error if an element of a constant list lit eral is not a
1861 * compile-time constant. 1032 * compile-time constant.
1862 */ 1033 */
1863 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = const CompileTim eErrorCode.con1('NON_CONSTANT_LIST_ELEMENT', 102, "'const' lists must have all c onstant values"); 1034 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = const CompileTim eErrorCode.con1('NON_CONSTANT_LIST_ELEMENT', 106, "'const' lists must have all c onstant values");
1864 1035
1865 /** 1036 /**
1866 * 12.7 Maps: It is a compile time error if either a key or a value of an entr y in a constant map 1037 * 12.7 Maps: It is a compile time error if either a key or a value of an entr y in a constant map
1867 * literal is not a compile-time constant. 1038 * literal is not a compile-time constant.
1868 */ 1039 */
1869 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = const CompileTimeErro rCode.con1('NON_CONSTANT_MAP_KEY', 103, "The keys in a map must be constant"); 1040 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = const CompileTimeErro rCode.con1('NON_CONSTANT_MAP_KEY', 107, "The keys in a map must be constant");
1870 1041
1871 /** 1042 /**
1872 * 12.7 Maps: It is a compile time error if either a key or a value of an entr y in a constant map 1043 * 12.7 Maps: It is a compile time error if either a key or a value of an entr y in a constant map
1873 * literal is not a compile-time constant. 1044 * literal is not a compile-time constant.
1874 */ 1045 */
1875 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = const CompileTimeEr rorCode.con1('NON_CONSTANT_MAP_VALUE', 104, "The values in a 'const' map must be constant"); 1046 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = const CompileTimeEr rorCode.con1('NON_CONSTANT_MAP_VALUE', 108, "The values in a 'const' map must be constant");
1876 1047
1877 /** 1048 /**
1878 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the 1049 * 11 Metadata: Metadata consists of a series of annotations, each of which be gin with the
1879 * character @, followed by a constant expression that must be either a refere nce to a 1050 * character @, followed by a constant expression that must be either a refere nce to a
1880 * compile-time constant variable, or a call to a constant constructor. 1051 * compile-time constant variable, or a call to a constant constructor.
1881 */ 1052 */
1882 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = const CompileTimeErrorCode.con1('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 105, "Annotatio n creation can use only 'const' constructor"); 1053 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = const CompileTimeErrorCode.con1('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 109, "Annotatio n creation can use only 'const' constructor");
1883 1054
1884 /** 1055 /**
1885 * 7.6.3 Constant Constructors: Any expression that appears within the initial izer list of a 1056 * 7.6.3 Constant Constructors: Any expression that appears within the initial izer list of a
1886 * constant constructor must be a potentially constant expression, or a compil e-time error occurs. 1057 * constant constructor must be a potentially constant expression, or a compil e-time error occurs.
1887 */ 1058 */
1888 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = const Co mpileTimeErrorCode.con1('NON_CONSTANT_VALUE_IN_INITIALIZER', 106, "Initializer e xpressions in constant constructors must be constants"); 1059 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = const Co mpileTimeErrorCode.con1('NON_CONSTANT_VALUE_IN_INITIALIZER', 110, "Initializer e xpressions in constant constructors must be constants");
1889 1060
1890 /** 1061 /**
1891 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m > n</i>. 1062 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m > n</i>.
1892 * 1063 *
1893 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 1064 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
1894 * uncaught exception being thrown. 1065 * uncaught exception being thrown.
1895 * 1066 *
1896 * @param requiredCount the expected number of required arguments 1067 * @param requiredCount the expected number of required arguments
1897 * @param argumentCount the actual number of positional arguments given 1068 * @param argumentCount the actual number of positional arguments given
1898 */ 1069 */
1899 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const Compil eTimeErrorCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 107, "%d required argument( s) expected, but %d found"); 1070 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const Compil eTimeErrorCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 111, "%d required argument( s) expected, but %d found");
1900 1071
1901 /** 1072 /**
1902 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears 1073 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears
1903 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is 1074 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is
1904 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i> 1075 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i>
1905 * (respectively <i>S.id</i>) 1076 * (respectively <i>S.id</i>)
1906 */ 1077 */
1907 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = const CompileTi meErrorCode.con1('NON_GENERATIVE_CONSTRUCTOR', 108, "The generative constructor '%s' expected, but factory found"); 1078 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = const CompileTi meErrorCode.con1('NON_GENERATIVE_CONSTRUCTOR', 112, "The generative constructor '%s' expected, but factory found");
1908 1079
1909 /** 1080 /**
1910 * 7.9 Superclasses: It is a compile-time error to specify an extends clause f or class Object. 1081 * 7.9 Superclasses: It is a compile-time error to specify an extends clause f or class Object.
1911 */ 1082 */
1912 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = const C ompileTimeErrorCode.con1('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 109, ""); 1083 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = const C ompileTimeErrorCode.con1('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 113, "");
1913 1084
1914 /** 1085 /**
1915 * 7.1.1 Operators: It is a compile-time error to declare an optional paramete r in an operator. 1086 * 7.1.1 Operators: It is a compile-time error to declare an optional paramete r in an operator.
1916 */ 1087 */
1917 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = const Compi leTimeErrorCode.con1('OPTIONAL_PARAMETER_IN_OPERATOR', 110, "Optional parameters are not allowed when defining an operator"); 1088 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = const Compi leTimeErrorCode.con1('OPTIONAL_PARAMETER_IN_OPERATOR', 114, "Optional parameters are not allowed when defining an operator");
1918 1089
1919 /** 1090 /**
1920 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part 1091 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
1921 * declaration. 1092 * declaration.
1922 * 1093 *
1923 * @param uri the uri pointing to a non-library declaration 1094 * @param uri the uri pointing to a non-library declaration
1924 */ 1095 */
1925 static const CompileTimeErrorCode PART_OF_NON_PART = const CompileTimeErrorCod e.con1('PART_OF_NON_PART', 111, "The included part '%s' must have a part-of dire ctive"); 1096 static const CompileTimeErrorCode PART_OF_NON_PART = const CompileTimeErrorCod e.con1('PART_OF_NON_PART', 115, "The included part '%s' must have a part-of dire ctive");
1926 1097
1927 /** 1098 /**
1928 * 14.1 Imports: It is a compile-time error if the current library declares a top-level member 1099 * 14.1 Imports: It is a compile-time error if the current library declares a top-level member
1929 * named <i>p</i>. 1100 * named <i>p</i>.
1930 */ 1101 */
1931 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = cons t CompileTimeErrorCode.con1('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 112, "The n ame '%s' is already used as an import prefix and cannot be used to name a top-le vel element"); 1102 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = cons t CompileTimeErrorCode.con1('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 116, "The n ame '%s' is already used as an import prefix and cannot be used to name a top-le vel element");
1932 1103
1933 /** 1104 /**
1934 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named o ptional parameter 1105 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named o ptional parameter
1935 * begins with an '_' character. 1106 * begins with an '_' character.
1936 */ 1107 */
1937 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = const CompileTi meErrorCode.con1('PRIVATE_OPTIONAL_PARAMETER', 113, "Named optional parameters c annot start with an underscore"); 1108 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = const CompileTi meErrorCode.con1('PRIVATE_OPTIONAL_PARAMETER', 117, "Named optional parameters c annot start with an underscore");
1938 1109
1939 /** 1110 /**
1940 * 12.1 Constants: It is a compile-time error if the value of a compile-time c onstant expression 1111 * 12.1 Constants: It is a compile-time error if the value of a compile-time c onstant expression
1941 * depends on itself. 1112 * depends on itself.
1942 */ 1113 */
1943 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = const Comp ileTimeErrorCode.con1('RECURSIVE_COMPILE_TIME_CONSTANT', 114, ""); 1114 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = const Comp ileTimeErrorCode.con1('RECURSIVE_COMPILE_TIME_CONSTANT', 118, "");
1944 1115
1945 /** 1116 /**
1946 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its 1117 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
1947 * only action is to invoke another generative constructor. 1118 * only action is to invoke another generative constructor.
1948 * 1119 *
1949 * TODO(scheglov) review this later, there are no explicit "it is a compile-ti me error" in 1120 * TODO(scheglov) review this later, there are no explicit "it is a compile-ti me error" in
1950 * specification. But it was added to the co19 and there is same error for fac tories. 1121 * specification. But it was added to the co19 and there is same error for fac tories.
1951 * 1122 *
1952 * https://code.google.com/p/dart/issues/detail?id=954 1123 * https://code.google.com/p/dart/issues/detail?id=954
1953 */ 1124 */
1954 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = const Compi leTimeErrorCode.con1('RECURSIVE_CONSTRUCTOR_REDIRECT', 115, "Cycle in redirectin g generative constructors"); 1125 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = const Compi leTimeErrorCode.con1('RECURSIVE_CONSTRUCTOR_REDIRECT', 119, "Cycle in redirectin g generative constructors");
1955 1126
1956 /** 1127 /**
1957 * 7.6.2 Factories: It is a compile-time error if a redirecting factory constr uctor redirects to 1128 * 7.6.2 Factories: It is a compile-time error if a redirecting factory constr uctor redirects to
1958 * itself, either directly or indirectly via a sequence of redirections. 1129 * itself, either directly or indirectly via a sequence of redirections.
1959 */ 1130 */
1960 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = const CompileTi meErrorCode.con1('RECURSIVE_FACTORY_REDIRECT', 116, "Cycle in redirecting factor y constructors"); 1131 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = const CompileTi meErrorCode.con1('RECURSIVE_FACTORY_REDIRECT', 120, "Cycle in redirecting factor y constructors");
1961 1132
1962 /** 1133 /**
1963 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a 1134 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a
1964 * superinterface of itself. 1135 * superinterface of itself.
1965 * 1136 *
1966 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself. 1137 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself.
1967 * 1138 *
1968 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself. 1139 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself.
1969 * 1140 *
1970 * @param className the name of the class that implements itself recursively 1141 * @param className the name of the class that implements itself recursively
1971 * @param strImplementsPath a string representation of the implements loop 1142 * @param strImplementsPath a string representation of the implements loop
1972 */ 1143 */
1973 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = const Comp ileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE', 117, "'%s' cannot be a superinterface of itself: %s"); 1144 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = const Comp ileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE', 121, "'%s' cannot be a superinterface of itself: %s");
1974 1145
1975 /** 1146 /**
1976 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a 1147 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a
1977 * superinterface of itself. 1148 * superinterface of itself.
1978 * 1149 *
1979 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself. 1150 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself.
1980 * 1151 *
1981 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself. 1152 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself.
1982 * 1153 *
1983 * @param className the name of the class that implements itself recursively 1154 * @param className the name of the class that implements itself recursively
1984 */ 1155 */
1985 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX TENDS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CA SE_EXTENDS', 118, "'%s' cannot extend itself"); 1156 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX TENDS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CA SE_EXTENDS', 122, "'%s' cannot extend itself");
1986 1157
1987 /** 1158 /**
1988 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a 1159 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas s <i>C</i> is a
1989 * superinterface of itself. 1160 * superinterface of itself.
1990 * 1161 *
1991 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself. 1162 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi nterface of itself.
1992 * 1163 *
1993 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself. 1164 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a super class of itself.
1994 * 1165 *
1995 * @param className the name of the class that implements itself recursively 1166 * @param className the name of the class that implements itself recursively
1996 */ 1167 */
1997 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM PLEMENTS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE _CASE_IMPLEMENTS', 119, "'%s' cannot implement itself"); 1168 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM PLEMENTS = const CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE _CASE_IMPLEMENTS', 123, "'%s' cannot implement itself");
1998 1169
1999 /** 1170 /**
2000 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but 1171 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but
2001 * <i>k'</i> is not a constant constructor. 1172 * <i>k'</i> is not a constant constructor.
2002 */ 1173 */
2003 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = const Comp ileTimeErrorCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 120, "The constructor ' %s' could not be found in '%s'"); 1174 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = const Comp ileTimeErrorCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 124, "The constructor ' %s' could not be found in '%s'");
2004 1175
2005 /** 1176 /**
2006 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but 1177 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but
2007 * <i>k'</i> is not a constant constructor. 1178 * <i>k'</i> is not a constant constructor.
2008 */ 1179 */
2009 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = const CompileTimeErr orCode.con1('REDIRECT_TO_NON_CLASS', 121, "The name '%s' is not a type and canno t be used in a redirected constructor"); 1180 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = const CompileTimeErr orCode.con1('REDIRECT_TO_NON_CLASS', 125, "The name '%s' is not a type and canno t be used in a redirected constructor");
2010 1181
2011 /** 1182 /**
2012 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but 1183 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th e const modifier but
2013 * <i>k'</i> is not a constant constructor. 1184 * <i>k'</i> is not a constant constructor.
2014 */ 1185 */
2015 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = const Co mpileTimeErrorCode.con1('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 122, "Constant fact ory constructor cannot delegate to a non-constant constructor"); 1186 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = const Co mpileTimeErrorCode.con1('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 126, "Constant fact ory constructor cannot delegate to a non-constant constructor");
2016 1187
2017 /** 1188 /**
2018 * 5 Variables: A local variable may only be referenced at a source code locat ion that is after 1189 * 5 Variables: A local variable may only be referenced at a source code locat ion that is after
2019 * its initializer, if any, is complete, or a compile-time error occurs. 1190 * its initializer, if any, is complete, or a compile-time error occurs.
2020 */ 1191 */
2021 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = const Compil eTimeErrorCode.con1('REFERENCED_BEFORE_DECLARATION', 123, "Local variables canno t be referenced before they are declared"); 1192 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = const Compil eTimeErrorCode.con1('REFERENCED_BEFORE_DECLARATION', 127, "Local variables canno t be referenced before they are declared");
2022 1193
2023 /** 1194 /**
2024 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form <i> rethrow;</i> is not 1195 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form <i> rethrow;</i> is not
2025 * enclosed within a on-catch clause. 1196 * enclosed within a on-catch clause.
2026 */ 1197 */
2027 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = const CompileTimeErr orCode.con1('RETHROW_OUTSIDE_CATCH', 124, "rethrow must be inside of a catch cla use"); 1198 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = const CompileTimeErr orCode.con1('RETHROW_OUTSIDE_CATCH', 128, "rethrow must be inside of a catch cla use");
2028 1199
2029 /** 1200 /**
2030 * 13.12 Return: It is a compile-time error if a return statement of the form <i>return e;</i> 1201 * 13.12 Return: It is a compile-time error if a return statement of the form <i>return e;</i>
2031 * appears in a generative constructor. 1202 * appears in a generative constructor.
2032 */ 1203 */
2033 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = const Com pileTimeErrorCode.con1('RETURN_IN_GENERATIVE_CONSTRUCTOR', 125, "Constructors ca nnot return a value"); 1204 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = const Com pileTimeErrorCode.con1('RETURN_IN_GENERATIVE_CONSTRUCTOR', 129, "Constructors ca nnot return a value");
2034 1205
2035 /** 1206 /**
2036 * Speculative. 1207 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred imp ort is used in
2037 */ 1208 * another import clause.
2038 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = const CompileTimeEr rorCode.con1('SHARED_DEFERRED_PREFIX', 126, "The prefix of a deferred import can not be used in other import directives"); 1209 */
1210 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = const CompileTimeEr rorCode.con1('SHARED_DEFERRED_PREFIX', 130, "The prefix of a deferred import can not be used in other import directives");
2039 1211
2040 /** 1212 /**
2041 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form 1213 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
2042 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip; 1214 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip;
2043 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a compile-time error if a supe r method invocation 1215 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a compile-time error if a supe r method invocation
2044 * occurs in a top-level function or variable initializer, in an instance vari able initializer or 1216 * occurs in a top-level function or variable initializer, in an instance vari able initializer or
2045 * initializer list, in class Object, in a factory constructor, or in a static method or variable 1217 * initializer list, in class Object, in a factory constructor, or in a static method or variable
2046 * initializer. 1218 * initializer.
2047 */ 1219 */
2048 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = const CompileTime ErrorCode.con1('SUPER_IN_INVALID_CONTEXT', 127, "Invalid context for 'super' inv ocation"); 1220 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = const CompileTime ErrorCode.con1('SUPER_IN_INVALID_CONTEXT', 131, "Invalid context for 'super' inv ocation");
2049 1221
2050 /** 1222 /**
2051 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its 1223 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
2052 * only action is to invoke another generative constructor. 1224 * only action is to invoke another generative constructor.
2053 */ 1225 */
2054 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = const Com pileTimeErrorCode.con1('SUPER_IN_REDIRECTING_CONSTRUCTOR', 128, "The redirecting constructor cannot have a 'super' initializer"); 1226 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = const Com pileTimeErrorCode.con1('SUPER_IN_REDIRECTING_CONSTRUCTOR', 132, "The redirecting constructor cannot have a 'super' initializer");
2055 1227
2056 /** 1228 /**
2057 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time 1229 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
2058 * error if a generative constructor of class Object includes a superinitializ er. 1230 * error if a generative constructor of class Object includes a superinitializ er.
2059 */ 1231 */
2060 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = const CompileT imeErrorCode.con1('SUPER_INITIALIZER_IN_OBJECT', 129, ""); 1232 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = const CompileT imeErrorCode.con1('SUPER_INITIALIZER_IN_OBJECT', 133, "");
2061 1233
2062 /** 1234 /**
2063 * 12.11 Instance Creation: It is a static type warning if any of the type arg uments to a 1235 * 12.11 Instance Creation: It is a static type warning if any of the type arg uments to a
2064 * constructor of a generic type <i>G</i> invoked by a new expression or a con stant object 1236 * constructor of a generic type <i>G</i> invoked by a new expression or a con stant object
2065 * expression are not subtypes of the bounds of the corresponding formal type parameters of 1237 * expression are not subtypes of the bounds of the corresponding formal type parameters of
2066 * <i>G</i>. 1238 * <i>G</i>.
2067 * 1239 *
2068 * 12.11.1 New: If T is malformed a dynamic error occurs. In checked mode, if T is mal-bounded a 1240 * 12.11.1 New: If T is malformed a dynamic error occurs. In checked mode, if T is mal-bounded a
2069 * dynamic error occurs. 1241 * dynamic error occurs.
2070 * 1242 *
2071 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time constant would raise 1243 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time constant would raise
2072 * an exception. 1244 * an exception.
2073 * 1245 *
2074 * @param boundedTypeName the name of the type used in the instance creation t hat should be 1246 * @param boundedTypeName the name of the type used in the instance creation t hat should be
2075 * limited by the bound as specified in the class declaration 1247 * limited by the bound as specified in the class declaration
2076 * @param boundingTypeName the name of the bounding type 1248 * @param boundingTypeName the name of the bounding type
2077 * @see StaticTypeWarningCode#TYPE_ARGUMENT_NOT_MATCHING_BOUNDS 1249 * @see StaticTypeWarningCode#TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
2078 */ 1250 */
2079 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const Co mpileTimeErrorCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 130, "'%s' does not extend '%s'"); 1251 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const Co mpileTimeErrorCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 134, "'%s' does not extend '%s'");
2080 1252
2081 /** 1253 /**
2082 * 15.3.1 Typedef: Any self reference, either directly, or recursively via ano ther typedef, is a 1254 * 15.3.1 Typedef: Any self reference, either directly, or recursively via ano ther typedef, is a
2083 * compile time error. 1255 * compile time error.
2084 */ 1256 */
2085 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = const C ompileTimeErrorCode.con1('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', 131, "Type alias cannot reference itself directly or recursively via another typedef"); 1257 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = const C ompileTimeErrorCode.con1('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', 135, "Type alias cannot reference itself directly or recursively via another typedef");
2086 1258
2087 /** 1259 /**
2088 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access ible in the current 1260 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access ible in the current
2089 * scope, optionally followed by type arguments. 1261 * scope, optionally followed by type arguments.
2090 */ 1262 */
2091 static const CompileTimeErrorCode UNDEFINED_CLASS = const CompileTimeErrorCode .con1('UNDEFINED_CLASS', 132, "Undefined class '%s'"); 1263 static const CompileTimeErrorCode UNDEFINED_CLASS = const CompileTimeErrorCode .con1('UNDEFINED_CLASS', 136, "Undefined class '%s'");
2092 1264
2093 /** 1265 /**
2094 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears 1266 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears
2095 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is 1267 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is
2096 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i> 1268 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i>
2097 * (respectively <i>S.id</i>) 1269 * (respectively <i>S.id</i>)
2098 */ 1270 */
2099 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = const CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 133, "The cla ss '%s' does not have a generative constructor '%s'"); 1271 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = const CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 137, "The cla ss '%s' does not have a generative constructor '%s'");
2100 1272
2101 /** 1273 /**
2102 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears 1274 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super initializer appears
2103 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is 1275 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ e constructor. It is
2104 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i> 1276 * a compile-time error if class <i>S</i> does not declare a generative constr uctor named <i>S</i>
2105 * (respectively <i>S.id</i>) 1277 * (respectively <i>S.id</i>)
2106 */ 1278 */
2107 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = const CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT ', 134, "The class '%s' does not have a default generative constructor"); 1279 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = const CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT ', 138, "The class '%s' does not have a default generative constructor");
2108 1280
2109 /** 1281 /**
2110 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>, 1282 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
2111 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i > ... 1283 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i > ...
2112 * <i>p<sub>n+k</sub></i>} or a static warning occurs. 1284 * <i>p<sub>n+k</sub></i>} or a static warning occurs.
2113 * 1285 *
2114 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 1286 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
2115 * uncaught exception being thrown. 1287 * uncaught exception being thrown.
2116 * 1288 *
2117 * @param name the name of the requested named parameter 1289 * @param name the name of the requested named parameter
2118 */ 1290 */
2119 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = const CompileTim eErrorCode.con1('UNDEFINED_NAMED_PARAMETER', 135, "The named parameter '%s' is n ot defined"); 1291 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = const CompileTim eErrorCode.con1('UNDEFINED_NAMED_PARAMETER', 139, "The named parameter '%s' is n ot defined");
2120 1292
2121 /** 1293 /**
2122 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is 1294 * 14.2 Exports: It is a compile-time error if the compilation unit found at t he specified URI is
2123 * not a library declaration. 1295 * not a library declaration.
2124 * 1296 *
2125 * 14.1 Imports: It is a compile-time error if the compilation unit found at t he specified URI is 1297 * 14.1 Imports: It is a compile-time error if the compilation unit found at t he specified URI is
2126 * not a library declaration. 1298 * not a library declaration.
2127 * 1299 *
2128 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part 1300 * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
2129 * declaration. 1301 * declaration.
2130 * 1302 *
2131 * @param uri the URI pointing to a non-existent file 1303 * @param uri the URI pointing to a non-existent file
2132 * @see #INVALID_URI 1304 * @see #INVALID_URI
2133 */ 1305 */
2134 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = const CompileTimeErrorC ode.con1('URI_DOES_NOT_EXIST', 136, "Target of URI does not exist: '%s'"); 1306 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = const CompileTimeErrorC ode.con1('URI_DOES_NOT_EXIST', 140, "Target of URI does not exist: '%s'");
2135 1307
2136 /** 1308 /**
2137 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time constant, or if 1309 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time constant, or if
2138 * <i>x</i> involves string interpolation. 1310 * <i>x</i> involves string interpolation.
2139 * 1311 *
2140 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time co nstant, or if 1312 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time co nstant, or if
2141 * <i>s</i> involves string interpolation. 1313 * <i>s</i> involves string interpolation.
2142 * 1314 *
2143 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that d escribes a URI is 1315 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that d escribes a URI is
2144 * not a compile-time constant, or if <i>x</i> involves string interpolation. 1316 * not a compile-time constant, or if <i>x</i> involves string interpolation.
2145 */ 1317 */
2146 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = const CompileTimeEr rorCode.con1('URI_WITH_INTERPOLATION', 137, "URIs cannot use string interpolatio n"); 1318 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = const CompileTimeEr rorCode.con1('URI_WITH_INTERPOLATION', 141, "URIs cannot use string interpolatio n");
2147 1319
2148 /** 1320 /**
2149 * 7.1.1 Operators: It is a compile-time error if the arity of the user-declar ed operator []= is 1321 * 7.1.1 Operators: It is a compile-time error if the arity of the user-declar ed operator []= is
2150 * not 2. It is a compile time error if the arity of a user-declared operator with one of the 1322 * not 2. It is a compile time error if the arity of a user-declared operator with one of the
2151 * names: &lt;, &gt;, &lt;=, &gt;=, ==, +, /, ~/, *, %, |, ^, &, &lt;&lt;, &gt ;&gt;, [] is not 1. 1323 * names: &lt;, &gt;, &lt;=, &gt;=, ==, +, /, ~/, *, %, |, ^, &, &lt;&lt;, &gt ;&gt;, [] is not 1.
2152 * It is a compile time error if the arity of the user-declared operator - is not 0 or 1. It is a 1324 * It is a compile time error if the arity of the user-declared operator - is not 0 or 1. It is a
2153 * compile time error if the arity of the user-declared operator ~ is not 0. 1325 * compile time error if the arity of the user-declared operator ~ is not 0.
2154 * 1326 *
2155 * @param operatorName the name of the declared operator 1327 * @param operatorName the name of the declared operator
2156 * @param expectedNumberOfParameters the number of parameters expected 1328 * @param expectedNumberOfParameters the number of parameters expected
2157 * @param actualNumberOfParameters the number of parameters found in the opera tor declaration 1329 * @param actualNumberOfParameters the number of parameters found in the opera tor declaration
2158 */ 1330 */
2159 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = co nst CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 138, "O perator '%s' should declare exactly %d parameter(s), but %d found"); 1331 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = co nst CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 142, "O perator '%s' should declare exactly %d parameter(s), but %d found");
2160 1332
2161 /** 1333 /**
2162 * 7.1.1 Operators: It is a compile time error if the arity of the user-declar ed operator - is not 1334 * 7.1.1 Operators: It is a compile time error if the arity of the user-declar ed operator - is not
2163 * 0 or 1. 1335 * 0 or 1.
2164 * 1336 *
2165 * @param actualNumberOfParameters the number of parameters found in the opera tor declaration 1337 * @param actualNumberOfParameters the number of parameters found in the opera tor declaration
2166 */ 1338 */
2167 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU S = const CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MIN US', 139, "Operator '-' should declare 0 or 1 parameter, but %d found"); 1339 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU S = const CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MIN US', 143, "Operator '-' should declare 0 or 1 parameter, but %d found");
2168 1340
2169 /** 1341 /**
2170 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list does not include 1342 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list does not include
2171 * exactly one required formal parameter <i>p</i>. 1343 * exactly one required formal parameter <i>p</i>.
2172 */ 1344 */
2173 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = cons t CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 140, "Sette rs should declare exactly one required parameter"); 1345 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = cons t CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 144, "Sette rs should declare exactly one required parameter");
2174 1346
2175 static const List<CompileTimeErrorCode> values = const [ 1347 static const List<CompileTimeErrorCode> values = const [
2176 AMBIGUOUS_EXPORT, 1348 AMBIGUOUS_EXPORT,
2177 ARGUMENT_DEFINITION_TEST_NON_PARAMETER, 1349 ARGUMENT_DEFINITION_TEST_NON_PARAMETER,
2178 BUILT_IN_IDENTIFIER_AS_TYPE, 1350 BUILT_IN_IDENTIFIER_AS_TYPE,
2179 BUILT_IN_IDENTIFIER_AS_TYPE_NAME, 1351 BUILT_IN_IDENTIFIER_AS_TYPE_NAME,
2180 BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, 1352 BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME,
2181 BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME, 1353 BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME,
2182 CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, 1354 CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
2183 COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, 1355 COMPILE_TIME_CONSTANT_RAISES_EXCEPTION,
2184 CONFLICTING_GETTER_AND_METHOD, 1356 CONFLICTING_GETTER_AND_METHOD,
2185 CONFLICTING_METHOD_AND_GETTER, 1357 CONFLICTING_METHOD_AND_GETTER,
2186 CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, 1358 CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD,
2187 CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, 1359 CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD,
2188 CONFLICTING_TYPE_VARIABLE_AND_CLASS, 1360 CONFLICTING_TYPE_VARIABLE_AND_CLASS,
2189 CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 1361 CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
2190 CONST_CONSTRUCTOR_THROWS_EXCEPTION, 1362 CONST_CONSTRUCTOR_THROWS_EXCEPTION,
2191 CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, 1363 CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
2192 CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, 1364 CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
1365 CONST_DEFERRED_CLASS,
2193 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, 1366 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
2194 CONST_FORMAL_PARAMETER, 1367 CONST_FORMAL_PARAMETER,
2195 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, 1368 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE,
2196 CONST_INSTANCE_FIELD, 1369 CONST_INSTANCE_FIELD,
2197 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, 1370 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
2198 CONST_NOT_INITIALIZED, 1371 CONST_NOT_INITIALIZED,
2199 CONST_EVAL_TYPE_BOOL, 1372 CONST_EVAL_TYPE_BOOL,
2200 CONST_EVAL_TYPE_BOOL_NUM_STRING, 1373 CONST_EVAL_TYPE_BOOL_NUM_STRING,
2201 CONST_EVAL_TYPE_INT, 1374 CONST_EVAL_TYPE_INT,
2202 CONST_EVAL_TYPE_NUM, 1375 CONST_EVAL_TYPE_NUM,
(...skipping 11 matching lines...) Expand all
2214 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR, 1387 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
2215 DUPLICATE_CONSTRUCTOR_DEFAULT, 1388 DUPLICATE_CONSTRUCTOR_DEFAULT,
2216 DUPLICATE_CONSTRUCTOR_NAME, 1389 DUPLICATE_CONSTRUCTOR_NAME,
2217 DUPLICATE_DEFINITION, 1390 DUPLICATE_DEFINITION,
2218 DUPLICATE_DEFINITION_INHERITANCE, 1391 DUPLICATE_DEFINITION_INHERITANCE,
2219 DUPLICATE_NAMED_ARGUMENT, 1392 DUPLICATE_NAMED_ARGUMENT,
2220 EXPORT_INTERNAL_LIBRARY, 1393 EXPORT_INTERNAL_LIBRARY,
2221 EXPORT_OF_NON_LIBRARY, 1394 EXPORT_OF_NON_LIBRARY,
2222 EXTENDS_NON_CLASS, 1395 EXTENDS_NON_CLASS,
2223 EXTENDS_DISALLOWED_CLASS, 1396 EXTENDS_DISALLOWED_CLASS,
1397 EXTENDS_DEFERRED_CLASS,
2224 EXTRA_POSITIONAL_ARGUMENTS, 1398 EXTRA_POSITIONAL_ARGUMENTS,
2225 FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, 1399 FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
2226 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, 1400 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER,
2227 FINAL_INITIALIZED_MULTIPLE_TIMES, 1401 FINAL_INITIALIZED_MULTIPLE_TIMES,
2228 FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, 1402 FIELD_INITIALIZER_FACTORY_CONSTRUCTOR,
2229 FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, 1403 FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
2230 FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, 1404 FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR,
2231 GETTER_AND_METHOD_WITH_SAME_NAME, 1405 GETTER_AND_METHOD_WITH_SAME_NAME,
1406 IMPLEMENTS_DEFERRED_CLASS,
2232 IMPLEMENTS_DISALLOWED_CLASS, 1407 IMPLEMENTS_DISALLOWED_CLASS,
2233 IMPLEMENTS_DYNAMIC, 1408 IMPLEMENTS_DYNAMIC,
2234 IMPLEMENTS_NON_CLASS, 1409 IMPLEMENTS_NON_CLASS,
2235 IMPLEMENTS_REPEATED, 1410 IMPLEMENTS_REPEATED,
2236 IMPLEMENTS_SUPER_CLASS, 1411 IMPLEMENTS_SUPER_CLASS,
2237 IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 1412 IMPLICIT_THIS_REFERENCE_IN_INITIALIZER,
2238 IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION, 1413 IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION,
2239 IMPORT_INTERNAL_LIBRARY, 1414 IMPORT_INTERNAL_LIBRARY,
2240 IMPORT_OF_NON_LIBRARY, 1415 IMPORT_OF_NON_LIBRARY,
2241 INCONSISTENT_CASE_EXPRESSION_TYPES, 1416 INCONSISTENT_CASE_EXPRESSION_TYPES,
(...skipping 13 matching lines...) Expand all
2255 LABEL_IN_OUTER_SCOPE, 1430 LABEL_IN_OUTER_SCOPE,
2256 LABEL_UNDEFINED, 1431 LABEL_UNDEFINED,
2257 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, 1432 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
2258 MAP_KEY_TYPE_NOT_ASSIGNABLE, 1433 MAP_KEY_TYPE_NOT_ASSIGNABLE,
2259 MAP_VALUE_TYPE_NOT_ASSIGNABLE, 1434 MAP_VALUE_TYPE_NOT_ASSIGNABLE,
2260 MEMBER_WITH_CLASS_NAME, 1435 MEMBER_WITH_CLASS_NAME,
2261 METHOD_AND_GETTER_WITH_SAME_NAME, 1436 METHOD_AND_GETTER_WITH_SAME_NAME,
2262 MISSING_CONST_IN_LIST_LITERAL, 1437 MISSING_CONST_IN_LIST_LITERAL,
2263 MISSING_CONST_IN_MAP_LITERAL, 1438 MISSING_CONST_IN_MAP_LITERAL,
2264 MIXIN_DECLARES_CONSTRUCTOR, 1439 MIXIN_DECLARES_CONSTRUCTOR,
1440 MIXIN_DEFERRED_CLASS,
2265 MIXIN_INHERITS_FROM_NOT_OBJECT, 1441 MIXIN_INHERITS_FROM_NOT_OBJECT,
2266 MIXIN_OF_DISALLOWED_CLASS, 1442 MIXIN_OF_DISALLOWED_CLASS,
2267 MIXIN_OF_NON_CLASS, 1443 MIXIN_OF_NON_CLASS,
2268 MIXIN_REFERENCES_SUPER, 1444 MIXIN_REFERENCES_SUPER,
2269 MIXIN_WITH_NON_CLASS_SUPERCLASS, 1445 MIXIN_WITH_NON_CLASS_SUPERCLASS,
2270 MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, 1446 MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS,
2271 MULTIPLE_SUPER_INITIALIZERS, 1447 MULTIPLE_SUPER_INITIALIZERS,
2272 NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS, 1448 NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS,
2273 NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, 1449 NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
2274 NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, 1450 NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 const CompileTimeErrorCode.con2(String name, int ordinal, this.message, this.c orrection) : super(name, ordinal); 1518 const CompileTimeErrorCode.con2(String name, int ordinal, this.message, this.c orrection) : super(name, ordinal);
2343 1519
2344 @override 1520 @override
2345 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; 1521 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity;
2346 1522
2347 @override 1523 @override
2348 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; 1524 ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
2349 } 1525 }
2350 1526
2351 /** 1527 /**
2352 * The enumeration `PubSuggestionCode` defines the suggestions used for reportin g deviations 1528 * The enumeration `TodoCode` defines the single TODO `ErrorCode`.
2353 * from pub best practices. The convention for this class is for the name of the bad practice to
2354 * indicate the problem that caused the suggestion to be generated and for the m essage to explain
2355 * what is wrong and, when appropriate, how the situation can be corrected.
2356 */ 1529 */
2357 class PubSuggestionCode extends Enum<PubSuggestionCode> implements ErrorCode { 1530 class TodoCode extends Enum<TodoCode> implements ErrorCode {
2358 /** 1531 /**
2359 * It is a bad practice for a source file in a package "lib" directory hierarc hy to traverse 1532 * The single enum of TodoCode.
2360 * outside that directory hierarchy. For example, a source file in the "lib" d irectory should not 1533 */
2361 * contain a directive such as `import '../web/some.dart'` which references a file outside 1534 static const TodoCode TODO = const TodoCode('TODO', 0);
2362 * the lib directory. 1535
2363 */ 1536 static const List<TodoCode> values = const [TODO];
2364 static const PubSuggestionCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = const PubSuggestionCode.con1('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', 0, "A file in the 'lib' directory hierarchy should not reference a file outside that hierarchy"); 1537
2365 1538 /**
2366 /** 1539 * This matches the two common Dart task styles
2367 * It is a bad practice for a source file ouside a package "lib" directory hie rarchy to traverse 1540 *
2368 * into that directory hierarchy. For example, a source file in the "web" dire ctory should not 1541 * * TODO:
2369 * contain a directive such as `import '../lib/some.dart'` which references a file inside 1542 * * TODO(username):
2370 * the lib directory. 1543 *
2371 */ 1544 * As well as
2372 static const PubSuggestionCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = const PubSuggestionCode.con1('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', 1, "A file outside the 'lib' directory hierarchy should not reference a file in side that hierarchy. Use a package: reference instead."); 1545 * * TODO
2373 1546 *
2374 /** 1547 * But not
2375 * It is a bad practice for a package import to reference anything outside the given package, or 1548 * * todo
2376 * more generally, it is bad practice for a package import to contain a "..". For example, a 1549 * * TODOS
2377 * source file should not contain a directive such as `import 'package:foo/../ some.dart'`. 1550 */
2378 */ 1551 static RegExp TODO_REGEX = new RegExp("([\\s/\\*])((TODO[^\\w\\d][^\\r\\n]*)|( TODO:?\$))");
2379 static const PubSuggestionCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const PubSugg estionCode.con1('PACKAGE_IMPORT_CONTAINS_DOT_DOT', 2, "A package import should n ot contain '..'"); 1552
2380 1553 const TodoCode(String name, int ordinal) : super(name, ordinal);
2381 static const List<PubSuggestionCode> values = const [ 1554
2382 FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, 1555 @override
2383 FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE, 1556 String get correction => null;
2384 PACKAGE_IMPORT_CONTAINS_DOT_DOT]; 1557
1558 @override
1559 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
1560
1561 @override
1562 String get message => "%s";
1563
1564 @override
1565 ErrorType get type => ErrorType.TODO;
1566 }
1567
1568 /**
1569 * Instances of the class `ErrorReporter` wrap an error listener with utility me thods used to
1570 * create the errors being reported.
1571 */
1572 class ErrorReporter {
1573 /**
1574 * The error listener to which errors will be reported.
1575 */
1576 final AnalysisErrorListener _errorListener;
1577
1578 /**
1579 * The default source to be used when reporting errors.
1580 */
1581 final Source _defaultSource;
1582
1583 /**
1584 * The source to be used when reporting errors.
1585 */
1586 Source _source;
1587
1588 /**
1589 * Initialize a newly created error reporter that will report errors to the gi ven listener.
1590 *
1591 * @param errorListener the error listener to which errors will be reported
1592 * @param defaultSource the default source to be used when reporting errors
1593 */
1594 ErrorReporter(this._errorListener, this._defaultSource) {
1595 if (_errorListener == null) {
1596 throw new IllegalArgumentException("An error listener must be provided");
1597 } else if (_defaultSource == null) {
1598 throw new IllegalArgumentException("A default source must be provided");
1599 }
1600 this._source = _defaultSource;
1601 }
1602
1603 /**
1604 * Creates an error with properties with the given error code and arguments.
1605 *
1606 * @param errorCode the error code of the error to be reported
1607 * @param node the node specifying the location of the error
1608 * @param arguments the arguments to the error, used to compose the error mess age
1609 */
1610 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, AstNod e node, List<Object> arguments) => new AnalysisErrorWithProperties.con2(_source, node.offset, node.length, errorCode, arguments);
1611
1612 /**
1613 * Report a passed error.
1614 *
1615 * @param error the error to report
1616 */
1617 void reportError(AnalysisError error) {
1618 _errorListener.onError(error);
1619 }
1620
1621 /**
1622 * Report an error with the given error code and arguments.
1623 *
1624 * @param errorCode the error code of the error to be reported
1625 * @param node the node specifying the location of the error
1626 * @param arguments the arguments to the error, used to compose the error mess age
1627 */
1628 void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> argume nts) {
1629 reportErrorForOffset(errorCode, node.offset, node.length, arguments);
1630 }
1631
1632 /**
1633 * Report an error with the given error code and arguments.
1634 *
1635 * @param errorCode the error code of the error to be reported
1636 * @param element the element which name should be used as the location of the error
1637 * @param arguments the arguments to the error, used to compose the error mess age
1638 */
1639 void reportErrorForElement(ErrorCode errorCode, Element element, List<Object> arguments) {
1640 reportErrorForOffset(errorCode, element.nameOffset, element.displayName.leng th, arguments);
1641 }
1642
1643 /**
1644 * Report an error with the given error code and arguments.
1645 *
1646 * @param errorCode the error code of the error to be reported
1647 * @param offset the offset of the location of the error
1648 * @param length the length of the location of the error
1649 * @param arguments the arguments to the error, used to compose the error mess age
1650 */
1651 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Ob ject> arguments) {
1652 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error Code, arguments));
1653 }
1654
1655 /**
1656 * Report an error with the given error code and arguments.
1657 *
1658 * @param errorCode the error code of the error to be reported
1659 * @param token the token specifying the location of the error
1660 * @param arguments the arguments to the error, used to compose the error mess age
1661 */
1662 void reportErrorForToken(ErrorCode errorCode, Token token, List<Object> argume nts) {
1663 reportErrorForOffset(errorCode, token.offset, token.length, arguments);
1664 }
1665
1666 /**
1667 * Set the source to be used when reporting errors. Setting the source to `nul l` will cause
1668 * the default source to be used.
1669 *
1670 * @param source the source to be used when reporting errors
1671 */
1672 void set source(Source source) {
1673 this._source = source == null ? _defaultSource : source;
1674 }
1675 }
1676
1677 /**
1678 * The enumeration `PolymerCode` defines Polymer specific problems.
1679 */
1680 class PolymerCode extends Enum<PolymerCode> implements ErrorCode {
1681 static const PolymerCode ATTRIBUTE_FIELD_NOT_PUBLISHED = const PolymerCode('AT TRIBUTE_FIELD_NOT_PUBLISHED', 0, "Field '%s' in '%s' must be @published");
1682
1683 static const PolymerCode DUPLICATE_ATTRIBUTE_DEFINITION = const PolymerCode('D UPLICATE_ATTRIBUTE_DEFINITION', 1, "The attribute '%s' is already defined");
1684
1685 static const PolymerCode EMPTY_ATTRIBUTES = const PolymerCode('EMPTY_ATTRIBUTE S', 2, "Empty 'attributes' attribute is useless");
1686
1687 static const PolymerCode INVALID_ATTRIBUTE_NAME = const PolymerCode('INVALID_A TTRIBUTE_NAME', 3, "'%s' is not a valid name for a custom element attribute");
1688
1689 static const PolymerCode INVALID_TAG_NAME = const PolymerCode('INVALID_TAG_NAM E', 4, "'%s' is not a valid name for a custom element");
1690
1691 static const PolymerCode MISSING_TAG_NAME = const PolymerCode('MISSING_TAG_NAM E', 5, "Missing tag name of the custom element. Please include an attribute like name='your-tag-name'");
1692
1693 static const PolymerCode UNDEFINED_ATTRIBUTE_FIELD = const PolymerCode('UNDEFI NED_ATTRIBUTE_FIELD', 6, "There is no such field '%s' in '%s'");
1694
1695 static const List<PolymerCode> values = const [
1696 ATTRIBUTE_FIELD_NOT_PUBLISHED,
1697 DUPLICATE_ATTRIBUTE_DEFINITION,
1698 EMPTY_ATTRIBUTES,
1699 INVALID_ATTRIBUTE_NAME,
1700 INVALID_TAG_NAME,
1701 MISSING_TAG_NAME,
1702 UNDEFINED_ATTRIBUTE_FIELD];
2385 1703
2386 /** 1704 /**
2387 * The template used to create the message to be displayed for this error. 1705 * The template used to create the message to be displayed for this error.
1706 */
1707 final String message;
1708
1709 /**
1710 * Initialize a newly created error code to have the given message.
1711 *
1712 * @param message the message template used to create the message to be displa yed for the error
1713 */
1714 const PolymerCode(String name, int ordinal, this.message) : super(name, ordina l);
1715
1716 @override
1717 String get correction => null;
1718
1719 @override
1720 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
1721
1722 @override
1723 ErrorType get type => ErrorType.POLYMER;
1724 }
1725
1726 /**
1727 * Instances of the class `AnalysisError` represent an error discovered during t he analysis of
1728 * some Dart code.
1729 *
1730 * @see AnalysisErrorListener
1731 */
1732 class AnalysisError {
1733 /**
1734 * An empty array of errors used when no errors are expected.
1735 */
1736 static List<AnalysisError> NO_ERRORS = new List<AnalysisError>(0);
1737
1738 /**
1739 * A [Comparator] that sorts by the name of the file that the [AnalysisError] was
1740 * found.
1741 */
1742 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, Analysis Error o2) => o1.source.shortName.compareTo(o2.source.shortName);
1743
1744 /**
1745 * A [Comparator] that sorts error codes first by their severity (errors first , warnings
1746 * second), and then by the the error code type.
1747 */
1748 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, An alysisError o2) {
1749 ErrorCode errorCode1 = o1.errorCode;
1750 ErrorCode errorCode2 = o2.errorCode;
1751 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity;
1752 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity;
1753 ErrorType errorType1 = errorCode1.type;
1754 ErrorType errorType2 = errorCode2.type;
1755 if (errorSeverity1 == errorSeverity2) {
1756 return errorType1.compareTo(errorType2);
1757 } else {
1758 return errorSeverity2.compareTo(errorSeverity1);
1759 }
1760 };
1761
1762 /**
1763 * The error code associated with the error.
1764 */
1765 final ErrorCode errorCode;
1766
1767 /**
1768 * The localized error message.
1769 */
1770 String _message;
1771
1772 /**
1773 * The correction to be displayed for this error, or `null` if there is no cor rection
1774 * information for this error.
1775 */
1776 String _correction;
1777
1778 /**
1779 * The source in which the error occurred, or `null` if unknown.
1780 */
1781 Source source;
1782
1783 /**
1784 * The character offset from the beginning of the source (zero based) where th e error occurred.
1785 */
1786 int _offset = 0;
1787
1788 /**
1789 * The number of characters from the offset to the end of the source which enc ompasses the
1790 * compilation error.
1791 */
1792 int _length = 0;
1793
1794 /**
1795 * A flag indicating whether this error can be shown to be a non-issue because of the result of
1796 * type propagation.
1797 */
1798 bool isStaticOnly = false;
1799
1800 /**
1801 * Initialize a newly created analysis error for the specified source. The err or has no location
1802 * information.
1803 *
1804 * @param source the source for which the exception occurred
1805 * @param errorCode the error code to be associated with this error
1806 * @param arguments the arguments used to build the error message
1807 */
1808 AnalysisError.con1(this.source, this.errorCode, List<Object> arguments) {
1809 this._message = JavaString.format(errorCode.message, arguments);
1810 }
1811
1812 /**
1813 * Initialize a newly created analysis error for the specified source at the g iven location.
1814 *
1815 * @param source the source for which the exception occurred
1816 * @param offset the offset of the location of the error
1817 * @param length the length of the location of the error
1818 * @param errorCode the error code to be associated with this error
1819 * @param arguments the arguments used to build the error message
1820 */
1821 AnalysisError.con2(this.source, int offset, int length, this.errorCode, List<O bject> arguments) {
1822 this._offset = offset;
1823 this._length = length;
1824 this._message = JavaString.format(errorCode.message, arguments);
1825 String correctionTemplate = errorCode.correction;
1826 if (correctionTemplate != null) {
1827 this._correction = JavaString.format(correctionTemplate, arguments);
1828 }
1829 }
1830
1831 @override
1832 bool operator ==(Object obj) {
1833 if (identical(obj, this)) {
1834 return true;
1835 }
1836 // prepare other AnalysisError
1837 if (obj is! AnalysisError) {
1838 return false;
1839 }
1840 AnalysisError other = obj as AnalysisError;
1841 // Quick checks.
1842 if (!identical(errorCode, other.errorCode)) {
1843 return false;
1844 }
1845 if (_offset != other._offset || _length != other._length) {
1846 return false;
1847 }
1848 if (isStaticOnly != other.isStaticOnly) {
1849 return false;
1850 }
1851 // Deep checks.
1852 if (_message != other._message) {
1853 return false;
1854 }
1855 if (source != other.source) {
1856 return false;
1857 }
1858 // OK
1859 return true;
1860 }
1861
1862 /**
1863 * Return the correction to be displayed for this error, or `null` if there is no correction
1864 * information for this error. The correction should indicate how the user can fix the error.
1865 *
1866 * @return the template used to create the correction to be displayed for this error
1867 */
1868 String get correction => _correction;
1869
1870 /**
1871 * Return the number of characters from the offset to the end of the source wh ich encompasses the
1872 * compilation error.
1873 *
1874 * @return the length of the error location
1875 */
1876 int get length => _length;
1877
1878 /**
1879 * Return the message to be displayed for this error. The message should indic ate what is wrong
1880 * and why it is wrong.
1881 *
1882 * @return the message to be displayed for this error
1883 */
1884 String get message => _message;
1885
1886 /**
1887 * Return the character offset from the beginning of the source (zero based) w here the error
1888 * occurred.
1889 *
1890 * @return the offset to the start of the error location
1891 */
1892 int get offset => _offset;
1893
1894 /**
1895 * Return the value of the given property, or `null` if the given property is not defined
1896 * for this error.
1897 *
1898 * @param property the property whose value is to be returned
1899 * @return the value of the given property
1900 */
1901 Object getProperty(ErrorProperty property) => null;
1902
1903 @override
1904 int get hashCode {
1905 int hashCode = _offset;
1906 hashCode ^= (_message != null) ? _message.hashCode : 0;
1907 hashCode ^= (source != null) ? source.hashCode : 0;
1908 return hashCode;
1909 }
1910
1911 @override
1912 String toString() {
1913 JavaStringBuilder builder = new JavaStringBuilder();
1914 builder.append((source != null) ? source.fullName : "<unknown source>");
1915 builder.append("(");
1916 builder.append(_offset);
1917 builder.append("..");
1918 builder.append(_offset + _length - 1);
1919 builder.append("): ");
1920 //builder.append("(" + lineNumber + ":" + columnNumber + "): ");
1921 builder.append(_message);
1922 return builder.toString();
1923 }
1924 }
1925
1926 /**
1927 * Instances of the class `AnalysisErrorWithProperties`
1928 */
1929 class AnalysisErrorWithProperties extends AnalysisError {
1930 /**
1931 * The properties associated with this error.
1932 */
1933 Map<ErrorProperty, Object> _propertyMap = new Map<ErrorProperty, Object>();
1934
1935 /**
1936 * Initialize a newly created analysis error for the specified source. The err or has no location
1937 * information.
1938 *
1939 * @param source the source for which the exception occurred
1940 * @param errorCode the error code to be associated with this error
1941 * @param arguments the arguments used to build the error message
1942 */
1943 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje ct> arguments) : super.con1(source, errorCode, arguments);
1944
1945 /**
1946 * Initialize a newly created analysis error for the specified source at the g iven location.
1947 *
1948 * @param source the source for which the exception occurred
1949 * @param offset the offset of the location of the error
1950 * @param length the length of the location of the error
1951 * @param errorCode the error code to be associated with this error
1952 * @param arguments the arguments used to build the error message
1953 */
1954 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro rCode, arguments);
1955
1956 @override
1957 Object getProperty(ErrorProperty property) => _propertyMap[property];
1958
1959 /**
1960 * Set the value of the given property to the given value. Using a value of `n ull` will
1961 * effectively remove the property from this error.
1962 *
1963 * @param property the property whose value is to be returned
1964 * @param value the new value of the given property
1965 */
1966 void setProperty(ErrorProperty property, Object value) {
1967 _propertyMap[property] = value;
1968 }
1969 }
1970
1971 /**
1972 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode] .
1973 */
1974 class ErrorType extends Enum<ErrorType> {
1975 /**
1976 * Task (todo) comments in user code.
1977 */
1978 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO);
1979
1980 /**
1981 * Extra analysis run over the code to follow best practices, which are not in the Dart Language
1982 * Specification.
1983 */
1984 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO);
1985
1986 /**
1987 * Compile-time errors are errors that preclude execution. A compile time erro r must be reported
1988 * by a Dart compiler before the erroneous code is executed.
1989 */
1990 static const ErrorType COMPILE_TIME_ERROR = const ErrorType('COMPILE_TIME_ERRO R', 2, ErrorSeverity.ERROR);
1991
1992 /**
1993 * Suggestions made in situations where the user has deviated from recommended pub programming
1994 * practices.
1995 */
1996 static const ErrorType PUB_SUGGESTION = const ErrorType('PUB_SUGGESTION', 3, E rrorSeverity.WARNING);
1997
1998 /**
1999 * Static warnings are those warnings reported by the static checker. They hav e no effect on
2000 * execution. Static warnings must be provided by Dart compilers used during d evelopment.
2001 */
2002 static const ErrorType STATIC_WARNING = const ErrorType('STATIC_WARNING', 4, E rrorSeverity.WARNING);
2003
2004 /**
2005 * Many, but not all, static warnings relate to types, in which case they are known as static type
2006 * warnings.
2007 */
2008 static const ErrorType STATIC_TYPE_WARNING = const ErrorType('STATIC_TYPE_WARN ING', 5, ErrorSeverity.WARNING);
2009
2010 /**
2011 * Syntactic errors are errors produced as a result of input that does not con form to the grammar.
2012 */
2013 static const ErrorType SYNTACTIC_ERROR = const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR);
2014
2015 /**
2016 * Angular specific semantic problems.
2017 */
2018 static const ErrorType ANGULAR = const ErrorType('ANGULAR', 7, ErrorSeverity.I NFO);
2019
2020 /**
2021 * Polymer specific semantic problems.
2022 */
2023 static const ErrorType POLYMER = const ErrorType('POLYMER', 8, ErrorSeverity.I NFO);
2024
2025 static const List<ErrorType> values = const [
2026 TODO,
2027 HINT,
2028 COMPILE_TIME_ERROR,
2029 PUB_SUGGESTION,
2030 STATIC_WARNING,
2031 STATIC_TYPE_WARNING,
2032 SYNTACTIC_ERROR,
2033 ANGULAR,
2034 POLYMER];
2035
2036 /**
2037 * The severity of this type of error.
2038 */
2039 final ErrorSeverity severity;
2040
2041 /**
2042 * Initialize a newly created error type to have the given severity.
2043 *
2044 * @param severity the severity of this type of error
2045 */
2046 const ErrorType(String name, int ordinal, this.severity) : super(name, ordinal );
2047
2048 String get displayName => name.toLowerCase().replaceAll('_', ' ');
2049 }
2050
2051 /**
2052 * The interface `ErrorCode` defines the behavior common to objects representing error codes
2053 * associated with [AnalysisError].
2054 *
2055 * Generally, we want to provide messages that consist of three sentences: 1. wh at is wrong, 2. why
2056 * is it wrong, and 3. how do I fix it. However, we combine the first two in the result of
2057 * [getMessage] and the last in the result of [getCorrection].
2058 */
2059 abstract class ErrorCode {
2060 /**
2061 * Return the template used to create the correction to be displayed for this error, or
2062 * `null` if there is no correction information for this error. The correction should
2063 * indicate how the user can fix the error.
2064 *
2065 * @return the template used to create the correction to be displayed for this error
2066 */
2067 String get correction;
2068
2069 /**
2070 * Return the severity of this error.
2071 *
2072 * @return the severity of this error
2073 */
2074 ErrorSeverity get errorSeverity;
2075
2076 /**
2077 * Return the template used to create the message to be displayed for this err or. The message
2078 * should indicate what is wrong and why it is wrong.
2079 *
2080 * @return the template used to create the message to be displayed for this er ror
2081 */
2082 String get message;
2083
2084 /**
2085 * Return the type of the error.
2086 *
2087 * @return the type of the error
2088 */
2089 ErrorType get type;
2090 }
2091
2092 /**
2093 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er rorCode]
2094 * .
2095 */
2096 class ErrorSeverity extends Enum<ErrorSeverity> {
2097 /**
2098 * The severity representing a non-error. This is never used for any error cod e, but is useful for
2099 * clients.
2100 */
2101 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none");
2102
2103 /**
2104 * The severity representing an informational level analysis issue.
2105 */
2106 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info");
2107
2108 /**
2109 * The severity representing a warning. Warnings can become errors if the `-We rror` command
2110 * line flag is specified.
2111 */
2112 static const ErrorSeverity WARNING = const ErrorSeverity('WARNING', 2, "W", "w arning");
2113
2114 /**
2115 * The severity representing an error.
2116 */
2117 static const ErrorSeverity ERROR = const ErrorSeverity('ERROR', 3, "E", "error ");
2118
2119 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR];
2120
2121 /**
2122 * The name of the severity used when producing machine output.
2123 */
2124 final String machineCode;
2125
2126 /**
2127 * The name of the severity used when producing readable output.
2128 */
2129 final String displayName;
2130
2131 /**
2132 * Initialize a newly created severity with the given names.
2133 *
2134 * @param machineCode the name of the severity used when producing machine out put
2135 * @param displayName the name of the severity used when producing readable ou tput
2136 */
2137 const ErrorSeverity(String name, int ordinal, this.machineCode, this.displayNa me) : super(name, ordinal);
2138
2139 /**
2140 * Return the severity constant that represents the greatest severity.
2141 *
2142 * @param severity the severity being compared against
2143 * @return the most sever of this or the given severity
2144 */
2145 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal ? this : severity;
2146 }
2147
2148 /**
2149 * The interface `AnalysisErrorListener` defines the behavior of objects that li sten for
2150 * [AnalysisError] being produced by the analysis engine.
2151 */
2152 abstract class AnalysisErrorListener {
2153 /**
2154 * An error listener that ignores errors that are reported to it.
2155 */
2156 static final AnalysisErrorListener NULL_LISTENER = new AnalysisErrorListener_N ULL_LISTENER();
2157
2158 /**
2159 * This method is invoked when an error has been found by the analysis engine.
2160 *
2161 * @param error the error that was just found (not `null`)
2162 */
2163 void onError(AnalysisError error);
2164 }
2165
2166 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener {
2167 @override
2168 void onError(AnalysisError event) {
2169 }
2170 }
2171
2172 /**
2173 * The enumeration `StaticTypeWarningCode` defines the error codes used for stat ic type
2174 * warnings. The convention for this class is for the name of the error code to indicate the problem
2175 * that caused the error to be generated and for the error message to explain wh at is wrong and,
2176 * when appropriate, how the problem can be corrected.
2177 */
2178 class StaticTypeWarningCode extends Enum<StaticTypeWarningCode> implements Error Code {
2179 /**
2180 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose clas s implements the
2181 * built-in class <i>List&lt;E></i> is allocated.
2182 *
2183 * @param numTypeArgument the number of provided type arguments
2184 */
2185 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = const St aticTypeWarningCode.con1('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 0, "List literal re quires exactly one type arguments or none, but %d found");
2186
2187 /**
2188 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class implements the
2189 * built-in class <i>Map&lt;K, V></i> is allocated.
2190 *
2191 * @param numTypeArgument the number of provided type arguments
2192 */
2193 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = const Sta ticTypeWarningCode.con1('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 1, "Map literal requi res exactly two type arguments or none, but %d found");
2194
2195 /**
2196 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
2197 * warning if <i>T</i> does not have an accessible instance setter named <i>v= </i>.
2198 *
2199 * @see #UNDEFINED_SETTER
2200 */
2201 static const StaticTypeWarningCode INACCESSIBLE_SETTER = const StaticTypeWarni ngCode.con1('INACCESSIBLE_SETTER', 2, "");
2202
2203 /**
2204 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m ultiple members
2205 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> with the same name <i>n</i> t hat would be
2206 * inherited (because identically named members existed in several superinterf aces) then at most
2207 * one member is inherited.
2208 *
2209 * If the static types <i>T<sub>1</sub>, &hellip;, T<sub>k</sub></i> of the me mbers
2210 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> are not identical, then there must be a member
2211 * <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> &lt;: T<sub>i</sub>, 1 &lt; = x &lt;= k</i> for
2212 * all <i>i, 1 &lt;= i &lt;= k</i>, or a static type warning occurs. The membe r that is inherited
2213 * is <i>m<sub>x</sub></i>, if it exists; otherwise:
2214 * * Let <i>numberOfPositionals</i>(<i>f</i>) denote the number of positional parameters of a
2215 * function <i>f</i>, and let <i>numberOfRequiredParams</i>(<i>f</i>) denote t he number of
2216 * required parameters of a function <i>f</i>. Furthermore, let <i>s</i> denot e the set of all
2217 * named parameters of the <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i>. Then let
2218 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i>
2219 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= i <= k.</i>
2220 * If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, with <i>r</i> r equired parameters
2221 * of type <b>dynamic</b>, <i>h</i> positional parameters of type <b>dynamic</ b>, named parameters
2222 * <i>s</i> of type <b>dynamic</b> and return type <b>dynamic</b>.
2223 * * Otherwise none of the members <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></ i> is inherited.
2224 */
2225 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = const Sta ticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 3, "'%s' is inherited by at least two interfaces inconsistently, from %s");
2226
2227 /**
2228 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n ot have an
2229 * accessible (3.2) instance member named <i>m</i>.
2230 *
2231 * @param memberName the name of the static member
2232 * @see UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER
2233 */
2234 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = const St aticTypeWarningCode.con1('INSTANCE_ACCESS_TO_STATIC_MEMBER', 4, "Static member ' %s' cannot be accessed using instance access");
2235
2236 /**
2237 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i > may not be
2238 * assigned to the static type of <i>v</i>. The static type of the expression <i>v = e</i> is the
2239 * static type of <i>e</i>.
2240 *
2241 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i > may not be
2242 * assigned to the static type of <i>C.v</i>. The static type of the expressio n <i>C.v = e</i> is
2243 * the static type of <i>e</i>.
2244 *
2245 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
2246 * warning if the static type of <i>e<sub>2</sub></i> may not be assigned to < i>T</i>.
2247 *
2248 * @param rhsTypeName the name of the right hand side type
2249 * @param lhsTypeName the name of the left hand side type
2250 */
2251 static const StaticTypeWarningCode INVALID_ASSIGNMENT = const StaticTypeWarnin gCode.con1('INVALID_ASSIGNMENT', 5, "A value of type '%s' cannot be assigned to a variable of type '%s'");
2252
2253 /**
2254 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the form
2255 * <i>o.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</ sub>, &hellip;
2256 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>.
2257 *
2258 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if <i>T</i> does not
2259 * have an accessible instance member named <i>m</i>. If <i>T.m</i> exists, it is a static warning
2260 * if the type <i>F</i> of <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does
2261 * not exist, or if <i>F</i> is not a function type, the static type of <i>i</ i> is dynamic.
2262 *
2263 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> of <i>C.m</i> may
2264 * not be assigned to a function type.
2265 *
2266 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
2267 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip;
2268 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If <i>S.m</i> exists, it is a static warning if the type
2269 * <i>F</i> of <i>S.m</i> may not be assigned to a function type.
2270 *
2271 * @param nonFunctionIdentifier the name of the identifier that is not a funct ion type
2272 */
2273 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = const StaticTy peWarningCode.con1('INVOCATION_OF_NON_FUNCTION', 6, "'%s' is not a method");
2274
2275 /**
2276 * 12.14.4 Function Expression Invocation: A function expression invocation <i >i</i> has the form
2277 * <i>e<sub>f</sub>(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a <sub>n+1</sub>,
2278 * &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression.
2279 *
2280 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub> </i> may not be
2281 * assigned to a function type.
2282 */
2283 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = con st StaticTypeWarningCode.con1('INVOCATION_OF_NON_FUNCTION_EXPRESSION', 7, "Canno t invoke a non-function");
2284
2285 /**
2286 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s ub></i> may not be
2287 * assigned to bool.
2288 *
2289 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> may not be assigned
2290 * to bool.
2291 *
2292 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be assigned to bool.
2293 *
2294 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be assi gned to bool.
2295 */
2296 static const StaticTypeWarningCode NON_BOOL_CONDITION = const StaticTypeWarnin gCode.con1('NON_BOOL_CONDITION', 8, "Conditions must have a static type of 'bool '");
2297
2298 /**
2299 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not b e assigned to either
2300 * bool or () &rarr; bool
2301 */
2302 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = const StaticTypeWarni ngCode.con1('NON_BOOL_EXPRESSION', 9, "Assertions must be on either a 'bool' or '() -> bool'");
2303
2304 /**
2305 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the expr ession
2306 * <i>e</i>?<b>false<b> : <b>true</b>.
2307 *
2308 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s ub></i> may not be
2309 * assigned to bool.
2310 */
2311 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = const Static TypeWarningCode.con1('NON_BOOL_NEGATION_EXPRESSION', 10, "Negation argument must have a static type of 'bool'");
2312
2313 /**
2314 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, 1 &lt;= i &lt;=
2315 * n</i> does not denote a type in the enclosing lexical scope.
2316 */
2317 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = const StaticTyp eWarningCode.con1('NON_TYPE_AS_TYPE_ARGUMENT', 11, "The name '%s' is not a type and cannot be used as a parameterized type");
2318
2319 /**
2320 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not b e assigned to the
2321 * declared return type of the immediately enclosing function.
2322 *
2323 * @param actualReturnType the return type as declared in the return statement
2324 * @param expectedReturnType the expected return type as defined by the method
2325 * @param methodName the name of the method
2326 */
2327 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = const StaticTypeWa rningCode.con1('RETURN_OF_INVALID_TYPE', 12, "The return type '%s' is not a '%s' , as defined by the method '%s'");
2328
2329 /**
2330 * 12.11 Instance Creation: It is a static type warning if any of the type arg uments to a
2331 * constructor of a generic type <i>G</i> invoked by a new expression or a con stant object
2332 * expression are not subtypes of the bounds of the corresponding formal type parameters of
2333 * <i>G</i>.
2334 *
2335 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member <i>m</ i> of <i>G</i>, then
2336 * the static type of the member <i>m</i> of <i>G&lt;A<sub>1</sub>, &hellip;,
2337 * A<sub>n</sub>&gt;</i> is <i>[A<sub>1</sub>, &hellip;, A<sub>n</sub>/T<sub>1 </sub>, &hellip;,
2338 * T<sub>n</sub>]S</i> where <i>T<sub>1</sub>, &hellip;, T<sub>n</sub></i> are the formal type
2339 * parameters of <i>G</i>. Let <i>B<sub>i</sub></i> be the bounds of <i>T<sub> i</sub>, 1 &lt;= i
2340 * &lt;= n</i>. It is a static type warning if <i>A<sub>i</sub></i> is not a s ubtype of
2341 * <i>[A<sub>1</sub>, &hellip;, A<sub>n</sub>/T<sub>1</sub>, &hellip;,
2342 * T<sub>n</sub>]B<sub>i</sub>, 1 &lt;= i &lt;= n</i>.
2343 *
2344 * 7.6.2 Factories: It is a static type warning if any of the type arguments t o <i>k'</i> are not
2345 * subtypes of the bounds of the corresponding formal type parameters of type.
2346 *
2347 * @param boundedTypeName the name of the type used in the instance creation t hat should be
2348 * limited by the bound as specified in the class declaration
2349 * @param boundingTypeName the name of the bounding type
2350 * @see #TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND
2351 */
2352 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const S taticTypeWarningCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 13, "'%s' does no t extend '%s'");
2353
2354 /**
2355 * 10 Generics: It is a static type warning if a type parameter is a supertype of its upper bound.
2356 *
2357 * @param typeParameterName the name of the type parameter
2358 * @see #TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
2359 */
2360 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = con st StaticTypeWarningCode.con1('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', 14, "'%s' cannot be a supertype of its upper bound");
2361
2362 /**
2363 * 12.15.3 Unqualified Invocation: If there exists a lexically visible declara tion named
2364 * <i>id</i>, let <i>f<sub>id</sub></i> be the innermost such declaration. The n: [skip].
2365 * Otherwise, <i>f<sub>id</sub></i> is considered equivalent to the ordinary m ethod invocation
2366 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, <i>x <sub>n+1</sub></i> :
2367 * <i>a<sub>n+1</sub></i>, ..., <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i >).
2368 *
2369 * @param methodName the name of the method that is undefined
2370 */
2371 static const StaticTypeWarningCode UNDEFINED_FUNCTION = const StaticTypeWarnin gCode.con1('UNDEFINED_FUNCTION', 15, "The function '%s' is not defined");
2372
2373 /**
2374 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is a static type
2375 * warning if <i>T</i> does not have a getter named <i>m</i>.
2376 *
2377 * @param getterName the name of the getter
2378 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for
2379 */
2380 static const StaticTypeWarningCode UNDEFINED_GETTER = const StaticTypeWarningC ode.con1('UNDEFINED_GETTER', 16, "There is no such getter '%s' in '%s'");
2381
2382 /**
2383 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I t is a static type
2384 * warning if <i>T</i> does not have an accessible instance member named <i>m< /i>.
2385 *
2386 * @param methodName the name of the method that is undefined
2387 * @param typeName the resolved type name that the method lookup is happening on
2388 */
2389 static const StaticTypeWarningCode UNDEFINED_METHOD = const StaticTypeWarningC ode.con1('UNDEFINED_METHOD', 17, "The method '%s' is not defined for the class ' %s'");
2390
2391 /**
2392 * 12.18 Assignment: Evaluation of an assignment of the form
2393 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is equiva lent to the
2394 * evaluation of the expression (a, i, e){a.[]=(i, e); return e;} (<i>e<sub>1< /sub></i>,
2395 * <i>e<sub>2</sub></i>, <i>e<sub>2</sub></i>).
2396 *
2397 * 12.29 Assignable Expressions: An assignable expression of the form
2398 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method invocat ion of the operator
2399 * method [] on <i>e<sub>1</sub></i> with argument <i>e<sub>2</sub></i>.
2400 *
2401 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I t is a static type
2402 * warning if <i>T</i> does not have an accessible instance member named <i>m< /i>.
2403 *
2404 * @param operator the name of the operator
2405 * @param enclosingType the name of the enclosing type where the operator is b eing looked for
2406 */
2407 static const StaticTypeWarningCode UNDEFINED_OPERATOR = const StaticTypeWarnin gCode.con1('UNDEFINED_OPERATOR', 18, "There is no such operator '%s' in '%s'");
2408
2409 /**
2410 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
2411 * warning if <i>T</i> does not have an accessible instance setter named <i>v= </i>.
2412 *
2413 * @param setterName the name of the setter
2414 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for
2415 * @see #INACCESSIBLE_SETTER
2416 */
2417 static const StaticTypeWarningCode UNDEFINED_SETTER = const StaticTypeWarningC ode.con1('UNDEFINED_SETTER', 19, "There is no such setter '%s' in '%s'");
2418
2419 /**
2420 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
2421 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip;
2422 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static type warning if <i>S< /i> does not have an
2423 * accessible instance member named <i>m</i>.
2424 *
2425 * @param methodName the name of the method that is undefined
2426 * @param typeName the resolved type name that the method lookup is happening on
2427 */
2428 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = const StaticTypeWa rningCode.con1('UNDEFINED_SUPER_METHOD', 20, "There is no such method '%s' in '% s'");
2429
2430 /**
2431 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n ot have an
2432 * accessible (3.2) instance member named <i>m</i>.
2433 *
2434 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used when we are
2435 * able to find the name defined in a supertype. It exists to provide a more i nformative error
2436 * message.
2437 */
2438 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M EMBER = const StaticTypeWarningCode.con1('UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STA TIC_MEMBER', 21, "Static members from supertypes must be qualified by the name o f the defining type");
2439
2440 /**
2441 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a generic type with
2442 * exactly <i>n</i> type parameters.
2443 *
2444 * @param typeName the name of the type being referenced (<i>G</i>)
2445 * @param parameterCount the number of type parameters that were declared
2446 * @param argumentCount the number of type arguments provided
2447 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS
2448 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS
2449 */
2450 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = const Stat icTypeWarningCode.con1('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 22, "The type '%s' is d eclared with %d type parameters, but %d type arguments were given");
2451
2452 static const List<StaticTypeWarningCode> values = const [
2453 EXPECTED_ONE_LIST_TYPE_ARGUMENTS,
2454 EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
2455 INACCESSIBLE_SETTER,
2456 INCONSISTENT_METHOD_INHERITANCE,
2457 INSTANCE_ACCESS_TO_STATIC_MEMBER,
2458 INVALID_ASSIGNMENT,
2459 INVOCATION_OF_NON_FUNCTION,
2460 INVOCATION_OF_NON_FUNCTION_EXPRESSION,
2461 NON_BOOL_CONDITION,
2462 NON_BOOL_EXPRESSION,
2463 NON_BOOL_NEGATION_EXPRESSION,
2464 NON_TYPE_AS_TYPE_ARGUMENT,
2465 RETURN_OF_INVALID_TYPE,
2466 TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
2467 TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
2468 UNDEFINED_FUNCTION,
2469 UNDEFINED_GETTER,
2470 UNDEFINED_METHOD,
2471 UNDEFINED_OPERATOR,
2472 UNDEFINED_SETTER,
2473 UNDEFINED_SUPER_METHOD,
2474 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
2475 WRONG_NUMBER_OF_TYPE_ARGUMENTS];
2476
2477 /**
2478 * The template used to create the message to be displayed for this error.
2388 */ 2479 */
2389 final String message; 2480 final String message;
2390 2481
2391 /** 2482 /**
2392 * The template used to create the correction to be displayed for this error, or `null` if 2483 * The template used to create the correction to be displayed for this error, or `null` if
2393 * there is no correction information for this error. 2484 * there is no correction information for this error.
2394 */ 2485 */
2395 final String correction; 2486 final String correction;
2396 2487
2397 /** 2488 /**
2398 * Initialize a newly created error code to have the given message. 2489 * Initialize a newly created error code to have the given message.
2399 * 2490 *
2400 * @param message the message template used to create the message to be displa yed for the error 2491 * @param message the message template used to create the message to be displa yed for the error
2401 */ 2492 */
2402 const PubSuggestionCode.con1(String name, int ordinal, String message) : this. con2(name, ordinal, message, null); 2493 const StaticTypeWarningCode.con1(String name, int ordinal, String message) : t his.con2(name, ordinal, message, null);
2403 2494
2404 /** 2495 /**
2405 * Initialize a newly created error code to have the given message and correct ion. 2496 * Initialize a newly created error code to have the given message and correct ion.
2406 * 2497 *
2407 * @param message the template used to create the message to be displayed for the error 2498 * @param message the template used to create the message to be displayed for the error
2408 * @param correction the template used to create the correction to be displaye d for the error 2499 * @param correction the template used to create the correction to be displaye d for the error
2409 */ 2500 */
2410 const PubSuggestionCode.con2(String name, int ordinal, this.message, this.corr ection) : super(name, ordinal); 2501 const StaticTypeWarningCode.con2(String name, int ordinal, this.message, this. correction) : super(name, ordinal);
2411 2502
2412 @override 2503 @override
2413 ErrorSeverity get errorSeverity => ErrorType.PUB_SUGGESTION.severity; 2504 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity;
2414 2505
2415 @override 2506 @override
2416 ErrorType get type => ErrorType.PUB_SUGGESTION; 2507 ErrorType get type => ErrorType.STATIC_TYPE_WARNING;
2508 }
2509
2510 /**
2511 * The enumeration `AngularCode` defines Angular specific problems.
2512 */
2513 class AngularCode extends Enum<AngularCode> implements ErrorCode {
2514 static const AngularCode CANNOT_PARSE_SELECTOR = const AngularCode('CANNOT_PAR SE_SELECTOR', 0, "The selector '%s' cannot be parsed");
2515
2516 static const AngularCode INVALID_FORMATTER_NAME = const AngularCode('INVALID_F ORMATTER_NAME', 1, "Formatter name must be a simple identifier");
2517
2518 static const AngularCode INVALID_PROPERTY_KIND = const AngularCode('INVALID_PR OPERTY_KIND', 2, "Unknown property binding kind '%s', use one of the '@', '=>', '=>!' or '<=>'");
2519
2520 static const AngularCode INVALID_PROPERTY_FIELD = const AngularCode('INVALID_P ROPERTY_FIELD', 3, "Unknown property field '%s'");
2521
2522 static const AngularCode INVALID_PROPERTY_MAP = const AngularCode('INVALID_PRO PERTY_MAP', 4, "Argument 'map' must be a constant map literal");
2523
2524 static const AngularCode INVALID_PROPERTY_NAME = const AngularCode('INVALID_PR OPERTY_NAME', 5, "Property name must be a string literal");
2525
2526 static const AngularCode INVALID_PROPERTY_SPEC = const AngularCode('INVALID_PR OPERTY_SPEC', 6, "Property binding specification must be a string literal");
2527
2528 static const AngularCode INVALID_REPEAT_SYNTAX = const AngularCode('INVALID_RE PEAT_SYNTAX', 7, "Expected statement in form '_item_ in _collection_ [tracked by _id_]'");
2529
2530 static const AngularCode INVALID_REPEAT_ITEM_SYNTAX = const AngularCode('INVAL ID_REPEAT_ITEM_SYNTAX', 8, "Item must by identifier or in '(_key_, _value_)' pai r.");
2531
2532 static const AngularCode INVALID_URI = const AngularCode('INVALID_URI', 9, "In valid URI syntax: '%s'");
2533
2534 static const AngularCode MISSING_FORMATTER_COLON = const AngularCode('MISSING_ FORMATTER_COLON', 10, "Missing ':' before formatter argument");
2535
2536 static const AngularCode MISSING_NAME = const AngularCode('MISSING_NAME', 11, "Argument 'name' must be provided");
2537
2538 static const AngularCode MISSING_PUBLISH_AS = const AngularCode('MISSING_PUBLI SH_AS', 12, "Argument 'publishAs' must be provided");
2539
2540 static const AngularCode MISSING_SELECTOR = const AngularCode('MISSING_SELECTO R', 13, "Argument 'selector' must be provided");
2541
2542 static const AngularCode URI_DOES_NOT_EXIST = const AngularCode('URI_DOES_NOT_ EXIST', 14, "Target of URI does not exist: '%s'");
2543
2544 static const List<AngularCode> values = const [
2545 CANNOT_PARSE_SELECTOR,
2546 INVALID_FORMATTER_NAME,
2547 INVALID_PROPERTY_KIND,
2548 INVALID_PROPERTY_FIELD,
2549 INVALID_PROPERTY_MAP,
2550 INVALID_PROPERTY_NAME,
2551 INVALID_PROPERTY_SPEC,
2552 INVALID_REPEAT_SYNTAX,
2553 INVALID_REPEAT_ITEM_SYNTAX,
2554 INVALID_URI,
2555 MISSING_FORMATTER_COLON,
2556 MISSING_NAME,
2557 MISSING_PUBLISH_AS,
2558 MISSING_SELECTOR,
2559 URI_DOES_NOT_EXIST];
2560
2561 /**
2562 * The template used to create the message to be displayed for this error.
2563 */
2564 final String message;
2565
2566 /**
2567 * Initialize a newly created error code to have the given message.
2568 *
2569 * @param message the message template used to create the message to be displa yed for the error
2570 */
2571 const AngularCode(String name, int ordinal, this.message) : super(name, ordina l);
2572
2573 @override
2574 String get correction => null;
2575
2576 @override
2577 ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
2578
2579 @override
2580 ErrorType get type => ErrorType.ANGULAR;
2581 }
2582
2583 /**
2584 * The enumeration `HintCode` defines the hints and coding recommendations for b est practices
2585 * which are not mentioned in the Dart Language Specification.
2586 */
2587 class HintCode extends Enum<HintCode> implements ErrorCode {
2588 /**
2589 * This hint is generated anywhere where the
2590 * [StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE] would have been generated, if we used
2591 * propagated information for the warnings.
2592 *
2593 * @param actualType the name of the actual argument type
2594 * @param expectedType the name of the expected type
2595 * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
2596 */
2597 static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode.con1('ARGU MENT_TYPE_NOT_ASSIGNABLE', 0, "The argument type '%s' cannot be assigned to the parameter type '%s'");
2598
2599 /**
2600 * Dead code is code that is never reached, this can happen for instance if a statement follows a
2601 * return statement.
2602 */
2603 static const HintCode DEAD_CODE = const HintCode.con1('DEAD_CODE', 1, "Dead co de");
2604
2605 /**
2606 * Dead code is code that is never reached. This case covers cases where the u ser has catch
2607 * clauses after `catch (e)` or `on Object catch (e)`.
2608 */
2609 static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode.con1('D EAD_CODE_CATCH_FOLLOWING_CATCH', 2, "Dead code, catch clauses after a 'catch (e) ' or an 'on Object catch (e)' are never reached");
2610
2611 /**
2612 * Dead code is code that is never reached. This case covers cases where the u ser has an on-catch
2613 * clause such as `on A catch (e)`, where a supertype of `A` was already caugh t.
2614 *
2615 * @param subtypeName name of the subtype
2616 * @param supertypeName name of the supertype
2617 */
2618 static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode.con1('DEAD_C ODE_ON_CATCH_SUBTYPE', 3, "Dead code, this on-catch block will never be executed since '%s' is a subtype of '%s'");
2619
2620 /**
2621 * Deprecated members should not be invoked or used.
2622 *
2623 * @param memberName the name of the member
2624 */
2625 static const HintCode DEPRECATED_MEMBER_USE = const HintCode.con1('DEPRECATED_ MEMBER_USE', 4, "'%s' is deprecated");
2626
2627 /**
2628 * Duplicate imports.
2629 */
2630 static const HintCode DUPLICATE_IMPORT = const HintCode.con1('DUPLICATE_IMPORT ', 5, "Duplicate import");
2631
2632 /**
2633 * Hint to use the ~/ operator.
2634 */
2635 static const HintCode DIVISION_OPTIMIZATION = const HintCode.con1('DIVISION_OP TIMIZATION', 6, "The operator x ~/ y is more efficient than (x / y).toInt()");
2636
2637 /**
2638 * Hint for the `x is double` type checks.
2639 */
2640 static const HintCode IS_DOUBLE = const HintCode.con1('IS_DOUBLE', 7, "When co mpiled to JS, this test might return true when the left hand side is an int");
2641
2642 /**
2643 * Hint for the `x is int` type checks.
2644 */
2645 static const HintCode IS_INT = const HintCode.con1('IS_INT', 8, "When compiled to JS, this test might return true when the left hand side is a double");
2646
2647 /**
2648 * Hint for the `x is! double` type checks.
2649 */
2650 static const HintCode IS_NOT_DOUBLE = const HintCode.con1('IS_NOT_DOUBLE', 9, "When compiled to JS, this test might return false when the left hand side is an int");
2651
2652 /**
2653 * Hint for the `x is! int` type checks.
2654 */
2655 static const HintCode IS_NOT_INT = const HintCode.con1('IS_NOT_INT', 10, "When compiled to JS, this test might return false when the left hand side is a doubl e");
2656
2657 /**
2658 * This hint is generated anywhere where the [StaticTypeWarningCode#INVALID_AS SIGNMENT]
2659 * would have been generated, if we used propagated information for the warnin gs.
2660 *
2661 * @param rhsTypeName the name of the right hand side type
2662 * @param lhsTypeName the name of the left hand side type
2663 * @see StaticTypeWarningCode#INVALID_ASSIGNMENT
2664 */
2665 static const HintCode INVALID_ASSIGNMENT = const HintCode.con1('INVALID_ASSIGN MENT', 11, "A value of type '%s' cannot be assigned to a variable of type '%s'") ;
2666
2667 /**
2668 * Generate a hint for methods or functions that have a return type, but do no t have a non-void
2669 * return statement on all branches. At the end of methods or functions with n o return, Dart
2670 * implicitly returns `null`, avoiding these implicit returns is considered a best practice.
2671 *
2672 * @param returnType the name of the declared return type
2673 */
2674 static const HintCode MISSING_RETURN = const HintCode.con2('MISSING_RETURN', 1 2, "This function declares a return type of '%s', but does not end with a return statement", "Either add a return statement or change the return type to 'void'" );
2675
2676 /**
2677 * A getter with the override annotation does not override an existing getter.
2678 */
2679 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_GETTER', 13, "Getter does not override an inherited getter");
2680
2681 /**
2682 * A method with the override annotation does not override an existing method.
2683 */
2684 static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_METHOD', 14, "Method does not override an inherited method");
2685
2686 /**
2687 * A setter with the override annotation does not override an existing setter.
2688 */
2689 static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode.con1( 'OVERRIDE_ON_NON_OVERRIDING_SETTER', 15, "Setter does not override an inherited setter");
2690
2691 /**
2692 * Hint for classes that override equals, but not hashCode.
2693 *
2694 * @param className the name of the current class
2695 */
2696 static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode.con1( 'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', 16, "The class '%s' overrides 'operator==', but not 'get hashCode'");
2697
2698 /**
2699 * Type checks of the type `x is! Null` should be done with `x != null`.
2700 */
2701 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode.con1('TYPE_CHECK _IS_NOT_NULL', 17, "Tests for non-null should be done with '!= null'");
2702
2703 /**
2704 * Type checks of the type `x is Null` should be done with `x == null`.
2705 */
2706 static const HintCode TYPE_CHECK_IS_NULL = const HintCode.con1('TYPE_CHECK_IS_ NULL', 18, "Tests for null should be done with '== null'");
2707
2708 /**
2709 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ GETTER] or
2710 * [StaticWarningCode#UNDEFINED_GETTER] would have been generated, if we used propagated
2711 * information for the warnings.
2712 *
2713 * @param getterName the name of the getter
2714 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for
2715 * @see StaticTypeWarningCode#UNDEFINED_GETTER
2716 * @see StaticWarningCode#UNDEFINED_GETTER
2717 */
2718 static const HintCode UNDEFINED_GETTER = const HintCode.con1('UNDEFINED_GETTER ', 19, "There is no such getter '%s' in '%s'");
2719
2720 /**
2721 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ METHOD] would
2722 * have been generated, if we used propagated information for the warnings.
2723 *
2724 * @param methodName the name of the method that is undefined
2725 * @param typeName the resolved type name that the method lookup is happening on
2726 * @see StaticTypeWarningCode#UNDEFINED_METHOD
2727 */
2728 static const HintCode UNDEFINED_METHOD = const HintCode.con1('UNDEFINED_METHOD ', 20, "The method '%s' is not defined for the class '%s'");
2729
2730 /**
2731 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ OPERATOR]
2732 * would have been generated, if we used propagated information for the warnin gs.
2733 *
2734 * @param operator the name of the operator
2735 * @param enclosingType the name of the enclosing type where the operator is b eing looked for
2736 * @see StaticTypeWarningCode#UNDEFINED_OPERATOR
2737 */
2738 static const HintCode UNDEFINED_OPERATOR = const HintCode.con1('UNDEFINED_OPER ATOR', 21, "There is no such operator '%s' in '%s'");
2739
2740 /**
2741 * This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_ SETTER] or
2742 * [StaticWarningCode#UNDEFINED_SETTER] would have been generated, if we used propagated
2743 * information for the warnings.
2744 *
2745 * @param setterName the name of the setter
2746 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for
2747 * @see StaticTypeWarningCode#UNDEFINED_SETTER
2748 * @see StaticWarningCode#UNDEFINED_SETTER
2749 */
2750 static const HintCode UNDEFINED_SETTER = const HintCode.con1('UNDEFINED_SETTER ', 22, "There is no such setter '%s' in '%s'");
2751
2752 /**
2753 * Unnecessary cast.
2754 */
2755 static const HintCode UNNECESSARY_CAST = const HintCode.con1('UNNECESSARY_CAST ', 23, "Unnecessary cast");
2756
2757 /**
2758 * Unnecessary type checks, the result is always true.
2759 */
2760 static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode.con1('UNNE CESSARY_TYPE_CHECK_FALSE', 24, "Unnecessary type check, the result is always fal se");
2761
2762 /**
2763 * Unnecessary type checks, the result is always false.
2764 */
2765 static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode.con1('UNNEC ESSARY_TYPE_CHECK_TRUE', 25, "Unnecessary type check, the result is always true" );
2766
2767 /**
2768 * Unused imports are imports which are never not used.
2769 */
2770 static const HintCode UNUSED_IMPORT = const HintCode.con1('UNUSED_IMPORT', 26, "Unused import");
2771
2772 /**
2773 * Hint for cases where the source expects a method or function to return a no n-void result, but
2774 * the method or function signature returns void.
2775 *
2776 * @param name the name of the method or function that returns void
2777 */
2778 static const HintCode USE_OF_VOID_RESULT = const HintCode.con1('USE_OF_VOID_RE SULT', 27, "The result of '%s' is being used, even though it is declared to be ' void'");
2779
2780 static const List<HintCode> values = const [
2781 ARGUMENT_TYPE_NOT_ASSIGNABLE,
2782 DEAD_CODE,
2783 DEAD_CODE_CATCH_FOLLOWING_CATCH,
2784 DEAD_CODE_ON_CATCH_SUBTYPE,
2785 DEPRECATED_MEMBER_USE,
2786 DUPLICATE_IMPORT,
2787 DIVISION_OPTIMIZATION,
2788 IS_DOUBLE,
2789 IS_INT,
2790 IS_NOT_DOUBLE,
2791 IS_NOT_INT,
2792 INVALID_ASSIGNMENT,
2793 MISSING_RETURN,
2794 OVERRIDE_ON_NON_OVERRIDING_GETTER,
2795 OVERRIDE_ON_NON_OVERRIDING_METHOD,
2796 OVERRIDE_ON_NON_OVERRIDING_SETTER,
2797 OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
2798 TYPE_CHECK_IS_NOT_NULL,
2799 TYPE_CHECK_IS_NULL,
2800 UNDEFINED_GETTER,
2801 UNDEFINED_METHOD,
2802 UNDEFINED_OPERATOR,
2803 UNDEFINED_SETTER,
2804 UNNECESSARY_CAST,
2805 UNNECESSARY_TYPE_CHECK_FALSE,
2806 UNNECESSARY_TYPE_CHECK_TRUE,
2807 UNUSED_IMPORT,
2808 USE_OF_VOID_RESULT];
2809
2810 /**
2811 * The template used to create the message to be displayed for this error.
2812 */
2813 final String message;
2814
2815 /**
2816 * The template used to create the correction to be displayed for this error, or `null` if
2817 * there is no correction information for this error.
2818 */
2819 final String correction;
2820
2821 /**
2822 * Initialize a newly created error code to have the given message.
2823 *
2824 * @param message the message template used to create the message to be displa yed for the error
2825 */
2826 const HintCode.con1(String name, int ordinal, String message) : this.con2(name , ordinal, message, null);
2827
2828 /**
2829 * Initialize a newly created error code to have the given message and correct ion.
2830 *
2831 * @param message the template used to create the message to be displayed for the error
2832 * @param correction the template used to create the correction to be displaye d for the error
2833 */
2834 const HintCode.con2(String name, int ordinal, this.message, this.correction) : super(name, ordinal);
2835
2836 @override
2837 ErrorSeverity get errorSeverity => ErrorType.HINT.severity;
2838
2839 @override
2840 ErrorType get type => ErrorType.HINT;
2841 }
2842
2843 /**
2844 * Instances of the class `BooleanErrorListener` implement a listener that keeps track of
2845 * whether an error has been reported to it.
2846 */
2847 class BooleanErrorListener implements AnalysisErrorListener {
2848 /**
2849 * A flag indicating whether an error has been reported to this listener.
2850 */
2851 bool _errorReported = false;
2852
2853 /**
2854 * Return `true` if an error has been reported to this listener.
2855 *
2856 * @return `true` if an error has been reported to this listener
2857 */
2858 bool get errorReported => _errorReported;
2859
2860 @override
2861 void onError(AnalysisError error) {
2862 _errorReported = true;
2863 }
2417 } 2864 }
2418 2865
2419 /** 2866 /**
2420 * The enumeration `StaticWarningCode` defines the error codes used for static w arnings. The 2867 * The enumeration `StaticWarningCode` defines the error codes used for static w arnings. The
2421 * convention for this class is for the name of the error code to indicate the p roblem that caused 2868 * convention for this class is for the name of the error code to indicate the p roblem that caused
2422 * the error to be generated and for the error message to explain what is wrong and, when 2869 * the error to be generated and for the error message to explain what is wrong and, when
2423 * appropriate, how the problem can be corrected. 2870 * appropriate, how the problem can be corrected.
2424 */ 2871 */
2425 class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode { 2872 class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
2426 /** 2873 /**
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 /** 3102 /**
2656 * 14.1 Imports: It is a static warning to import two different libraries with the same name. 3103 * 14.1 Imports: It is a static warning to import two different libraries with the same name.
2657 * 3104 *
2658 * @param uri1 the uri pointing to a first library 3105 * @param uri1 the uri pointing to a first library
2659 * @param uri2 the uri pointing to a second library 3106 * @param uri2 the uri pointing to a second library
2660 * @param name the shared name of the imported libraries 3107 * @param name the shared name of the imported libraries
2661 */ 3108 */
2662 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = const StaticWa rningCode.con1('IMPORT_DUPLICATED_LIBRARY_NAME', 25, "The imported libraries '%s ' and '%s' should not have the same name '%s'"); 3109 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = const StaticWa rningCode.con1('IMPORT_DUPLICATED_LIBRARY_NAME', 25, "The imported libraries '%s ' and '%s' should not have the same name '%s'");
2663 3110
2664 /** 3111 /**
3112 * 14.1 Imports: It is a static warning if the specified URI of a deferred imp ort does not refer
3113 * to a library declaration.
3114 *
3115 * @param uri the uri pointing to a non-library declaration
3116 * @see CompileTimeErrorCode#IMPORT_OF_NON_LIBRARY
3117 */
3118 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = const StaticWarningCode .con1('IMPORT_OF_NON_LIBRARY', 26, "The imported library '%s' must not have a pa rt-of directive");
3119
3120 /**
2665 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m ultiple members 3121 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m ultiple members
2666 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> with the same name <i>n</i> t hat would be 3122 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> with the same name <i>n</i> t hat would be
2667 * inherited (because identically named members existed in several superinterf aces) then at most 3123 * inherited (because identically named members existed in several superinterf aces) then at most
2668 * one member is inherited. 3124 * one member is inherited.
2669 * 3125 *
2670 * If some but not all of the <i>m<sub>i</sub>, 1 &lt;= i &lt;= k</i> are gett ers none of the 3126 * If some but not all of the <i>m<sub>i</sub>, 1 &lt;= i &lt;= k</i> are gett ers none of the
2671 * <i>m<sub>i</sub></i> are inherited, and a static warning is issued. 3127 * <i>m<sub>i</sub></i> are inherited, and a static warning is issued.
2672 */ 3128 */
2673 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH OD = const StaticWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_ME THOD', 26, "'%s' is inherited as a getter and also a method"); 3129 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH OD = const StaticWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_ME THOD', 27, "'%s' is inherited as a getter and also a method");
2674 3130
2675 /** 3131 /**
2676 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a n instance method 3132 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a n instance method
2677 * named <i>n</i> and an accessible static member named <i>n</i> is declared i n a superclass of 3133 * named <i>n</i> and an accessible static member named <i>n</i> is declared i n a superclass of
2678 * <i>C</i>. 3134 * <i>C</i>.
2679 * 3135 *
2680 * @param memberName the name of the member with the name conflict 3136 * @param memberName the name of the member with the name conflict
2681 * @param superclassName the name of the enclosing class that has the static m ember 3137 * @param superclassName the name of the enclosing class that has the static m ember
2682 */ 3138 */
2683 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S TATIC = const StaticWarningCode.con1('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCL ASS_STATIC', 27, "'%s' collides with a static member in the superclass '%s'"); 3139 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S TATIC = const StaticWarningCode.con1('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCL ASS_STATIC', 28, "'%s' collides with a static member in the superclass '%s'");
2684 3140
2685 /** 3141 /**
2686 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a gette r <i>m2</i> and the 3142 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a gette r <i>m2</i> and the
2687 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3143 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2688 * 3144 *
2689 * @param actualReturnTypeName the name of the expected return type 3145 * @param actualReturnTypeName the name of the expected return type
2690 * @param expectedReturnType the name of the actual return type, not assignabl e to the 3146 * @param expectedReturnType the name of the actual return type, not assignabl e to the
2691 * actualReturnTypeName 3147 * actualReturnTypeName
2692 * @param className the name of the class where the overridden getter is decla red 3148 * @param className the name of the class where the overridden getter is decla red
2693 * @see #INVALID_METHOD_OVERRIDE_RETURN_TYPE 3149 * @see #INVALID_METHOD_OVERRIDE_RETURN_TYPE
2694 */ 3150 */
2695 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = const Sta ticWarningCode.con1('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 28, "The return type '%s' is not assignable to '%s' as required by the getter it is overriding from ' %s'"); 3151 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = const Sta ticWarningCode.con1('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 29, "The return type '%s' is not assignable to '%s' as required by the getter it is overriding from ' %s'");
2696 3152
2697 /** 3153 /**
2698 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3154 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2699 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3155 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2700 * 3156 *
2701 * @param actualParamTypeName the name of the expected parameter type 3157 * @param actualParamTypeName the name of the expected parameter type
2702 * @param expectedParamType the name of the actual parameter type, not assigna ble to the 3158 * @param expectedParamType the name of the actual parameter type, not assigna ble to the
2703 * actualParamTypeName 3159 * actualParamTypeName
2704 * @param className the name of the class where the overridden method is decla red 3160 * @param className the name of the class where the overridden method is decla red
2705 */ 3161 */
2706 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = cons t StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 29, "The pa rameter type '%s' is not assignable to '%s' as required by the method it is over riding from '%s'"); 3162 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = cons t StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 30, "The pa rameter type '%s' is not assignable to '%s' as required by the method it is over riding from '%s'");
2707 3163
2708 /** 3164 /**
2709 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3165 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2710 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3166 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2711 * 3167 *
2712 * @param actualParamTypeName the name of the expected parameter type 3168 * @param actualParamTypeName the name of the expected parameter type
2713 * @param expectedParamType the name of the actual parameter type, not assigna ble to the 3169 * @param expectedParamType the name of the actual parameter type, not assigna ble to the
2714 * actualParamTypeName 3170 * actualParamTypeName
2715 * @param className the name of the class where the overridden method is decla red 3171 * @param className the name of the class where the overridden method is decla red
2716 * @see #INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE 3172 * @see #INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE
2717 */ 3173 */
2718 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = con st StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 30, "The parameter type '%s' is not assignable to '%s' as required by the method it is ov erriding from '%s'"); 3174 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = con st StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 31, "The parameter type '%s' is not assignable to '%s' as required by the method it is ov erriding from '%s'");
2719 3175
2720 /** 3176 /**
2721 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3177 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2722 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3178 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2723 * 3179 *
2724 * @param actualParamTypeName the name of the expected parameter type 3180 * @param actualParamTypeName the name of the expected parameter type
2725 * @param expectedParamType the name of the actual parameter type, not assigna ble to the 3181 * @param expectedParamType the name of the actual parameter type, not assigna ble to the
2726 * actualParamTypeName 3182 * actualParamTypeName
2727 * @param className the name of the class where the overridden method is decla red 3183 * @param className the name of the class where the overridden method is decla red
2728 */ 3184 */
2729 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = c onst StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 31, " The parameter type '%s' is not assignable to '%s' as required by the method it i s overriding from '%s'"); 3185 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = c onst StaticWarningCode.con1('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 32, " The parameter type '%s' is not assignable to '%s' as required by the method it i s overriding from '%s'");
2730 3186
2731 /** 3187 /**
2732 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3188 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2733 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3189 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2734 * 3190 *
2735 * @param actualReturnTypeName the name of the expected return type 3191 * @param actualReturnTypeName the name of the expected return type
2736 * @param expectedReturnType the name of the actual return type, not assignabl e to the 3192 * @param expectedReturnType the name of the actual return type, not assignabl e to the
2737 * actualReturnTypeName 3193 * actualReturnTypeName
2738 * @param className the name of the class where the overridden method is decla red 3194 * @param className the name of the class where the overridden method is decla red
2739 * @see #INVALID_GETTER_OVERRIDE_RETURN_TYPE 3195 * @see #INVALID_GETTER_OVERRIDE_RETURN_TYPE
2740 */ 3196 */
2741 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = const Sta ticWarningCode.con1('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 32, "The return type '%s' is not assignable to '%s' as required by the method it is overriding from ' %s'"); 3197 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = const Sta ticWarningCode.con1('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 33, "The return type '%s' is not assignable to '%s' as required by the method it is overriding from ' %s'");
2742 3198
2743 /** 3199 /**
2744 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3200 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2745 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for 3201 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for
2746 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff erent default value 3202 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff erent default value
2747 * for <i>p</i>. 3203 * for <i>p</i>.
2748 */ 3204 */
2749 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED ', 33, "Parameters cannot override default values, this method overrides '%s.%s' where '%s' has a different value"); 3205 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED ', 34, "Parameters cannot override default values, this method overrides '%s.%s' where '%s' has a different value");
2750 3206
2751 /** 3207 /**
2752 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3208 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2753 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for 3209 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for
2754 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff erent default value 3210 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff erent default value
2755 * for <i>p</i>. 3211 * for <i>p</i>.
2756 */ 3212 */
2757 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT IONAL = const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_ POSITIONAL', 34, "Parameters cannot override default values, this method overrid es '%s.%s' where this positional parameter has a different value"); 3213 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT IONAL = const StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_ POSITIONAL', 35, "Parameters cannot override default values, this method overrid es '%s.%s' where this positional parameter has a different value");
2758 3214
2759 /** 3215 /**
2760 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3216 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2761 * instance member <i>m2</i> and <i>m1</i> does not declare all the named para meters declared by 3217 * instance member <i>m2</i> and <i>m1</i> does not declare all the named para meters declared by
2762 * <i>m2</i>. 3218 * <i>m2</i>.
2763 * 3219 *
2764 * @param paramCount the number of named parameters in the overridden member 3220 * @param paramCount the number of named parameters in the overridden member
2765 * @param className the name of the class from the overridden method 3221 * @param className the name of the class from the overridden method
2766 */ 3222 */
2767 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod e.con1('INVALID_OVERRIDE_NAMED', 35, "Missing the named parameter '%s' to match the overridden method from '%s'"); 3223 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod e.con1('INVALID_OVERRIDE_NAMED', 36, "Missing the named parameter '%s' to match the overridden method from '%s'");
2768 3224
2769 /** 3225 /**
2770 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3226 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2771 * instance member <i>m2</i> and <i>m1</i> has fewer positional parameters tha n <i>m2</i>. 3227 * instance member <i>m2</i> and <i>m1</i> has fewer positional parameters tha n <i>m2</i>.
2772 * 3228 *
2773 * @param paramCount the number of positional parameters in the overridden mem ber 3229 * @param paramCount the number of positional parameters in the overridden mem ber
2774 * @param className the name of the class from the overridden method 3230 * @param className the name of the class from the overridden method
2775 */ 3231 */
2776 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = const StaticWarni ngCode.con1('INVALID_OVERRIDE_POSITIONAL', 36, "Must have at least %d parameters to match the overridden method from '%s'"); 3232 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = const StaticWarni ngCode.con1('INVALID_OVERRIDE_POSITIONAL', 37, "Must have at least %d parameters to match the overridden method from '%s'");
2777 3233
2778 /** 3234 /**
2779 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an 3235 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i > overrides an
2780 * instance member <i>m2</i> and <i>m1</i> has a greater number of required pa rameters than 3236 * instance member <i>m2</i> and <i>m1</i> has a greater number of required pa rameters than
2781 * <i>m2</i>. 3237 * <i>m2</i>.
2782 * 3238 *
2783 * @param paramCount the number of required parameters in the overridden membe r 3239 * @param paramCount the number of required parameters in the overridden membe r
2784 * @param className the name of the class from the overridden method 3240 * @param className the name of the class from the overridden method
2785 */ 3241 */
2786 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = const StaticWarning Code.con1('INVALID_OVERRIDE_REQUIRED', 37, "Must have %d required parameters or less to match the overridden method from '%s'"); 3242 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = const StaticWarning Code.con1('INVALID_OVERRIDE_REQUIRED', 38, "Must have %d required parameters or less to match the overridden method from '%s'");
2787 3243
2788 /** 3244 /**
2789 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a sette r <i>m2</i> and the 3245 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a sette r <i>m2</i> and the
2790 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. 3246 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>.
2791 * 3247 *
2792 * @param actualParamTypeName the name of the expected parameter type 3248 * @param actualParamTypeName the name of the expected parameter type
2793 * @param expectedParamType the name of the actual parameter type, not assigna ble to the 3249 * @param expectedParamType the name of the actual parameter type, not assigna ble to the
2794 * actualParamTypeName 3250 * actualParamTypeName
2795 * @param className the name of the class where the overridden setter is decla red 3251 * @param className the name of the class where the overridden setter is decla red
2796 * @see #INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE 3252 * @see #INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE
2797 */ 3253 */
2798 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = con st StaticWarningCode.con1('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 38, "The parameter type '%s' is not assignable to '%s' as required by the setter it is ov erriding from '%s'"); 3254 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = con st StaticWarningCode.con1('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 39, "The parameter type '%s' is not assignable to '%s' as required by the setter it is ov erriding from '%s'");
2799 3255
2800 /** 3256 /**
2801 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> &hellip; 3257 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> &hellip;
2802 * <i>e<sub>n</sub></i>] is evaluated as follows: 3258 * <i>e<sub>n</sub></i>] is evaluated as follows:
2803 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument 3259 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument
2804 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i> 3260 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i>
2805 * 3261 *
2806 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 3262 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
2807 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 3263 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
2808 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 3264 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
2809 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 3265 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
2810 * j &lt;= m</i>. 3266 * j &lt;= m</i>.
2811 */ 3267 */
2812 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Static WarningCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 39, "The element type '%s' cannot be assigned to the list type '%s'"); 3268 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const Static WarningCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 40, "The element type '%s' cannot be assigned to the list type '%s'");
2813 3269
2814 /** 3270 /**
2815 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 3271 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
2816 * <i>e<sub>1</sub></i> &hellip; <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is evaluated as 3272 * <i>e<sub>1</sub></i> &hellip; <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is evaluated as
2817 * follows: 3273 * follows:
2818 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 3274 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
2819 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 3275 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
2820 * 3276 *
2821 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 3277 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
2822 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 3278 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
2823 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 3279 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
2824 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 3280 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
2825 * j &lt;= m</i>. 3281 * j &lt;= m</i>.
2826 */ 3282 */
2827 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const StaticWarni ngCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 40, "The element type '%s' cannot be assigned to the map key type '%s'"); 3283 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const StaticWarni ngCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 41, "The element type '%s' cannot be assigned to the map key type '%s'");
2828 3284
2829 /** 3285 /**
2830 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 3286 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
2831 * <i>e<sub>1</sub></i> &hellip; <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is evaluated as 3287 * <i>e<sub>1</sub></i> &hellip; <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is evaluated as
2832 * follows: 3288 * follows:
2833 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 3289 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
2834 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 3290 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
2835 * 3291 *
2836 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 3292 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
2837 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 3293 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
2838 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 3294 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
2839 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 3295 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
2840 * j &lt;= m</i>. 3296 * j &lt;= m</i>.
2841 */ 3297 */
2842 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const StaticWar ningCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 41, "The element type '%s' cannot be assigned to the map value type '%s'"); 3298 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const StaticWar ningCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 42, "The element type '%s' cannot be assigned to the map value type '%s'");
2843 3299
2844 /** 3300 /**
2845 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> with argument type 3301 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> with argument type
2846 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i > may not be 3302 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i > may not be
2847 * assigned to <i>S</i>. 3303 * assigned to <i>S</i>.
2848 */ 3304 */
2849 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = const Stat icWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES', 42, "The parameter type for setter '%s' is '%s' which is not assignable to its getter (of type '%s')"); 3305 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = const Stat icWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES', 43, "The parameter type for setter '%s' is '%s' which is not assignable to its getter (of type '%s')");
2850 3306
2851 /** 3307 /**
2852 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> with argument type 3308 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> with argument type
2853 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i > may not be 3309 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i > may not be
2854 * assigned to <i>S</i>. 3310 * assigned to <i>S</i>.
2855 */ 3311 */
2856 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY PE = const StaticWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPER TYPE', 43, "The parameter type for setter '%s' is '%s' which is not assignable t o its getter (of type '%s'), from superclass '%s'"); 3312 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY PE = const StaticWarningCode.con1('MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPER TYPE', 44, "The parameter type for setter '%s' is '%s' which is not assignable t o its getter (of type '%s'), from superclass '%s'");
2857 3313
2858 /** 3314 /**
2859 * 13.12 Return: It is a static warning if a function contains both one or mor e return statements 3315 * 13.12 Return: It is a static warning if a function contains both one or mor e return statements
2860 * of the form <i>return;</i> and one or more return statements of the form <i >return e;</i>. 3316 * of the form <i>return;</i> and one or more return statements of the form <i >return e;</i>.
2861 */ 3317 */
2862 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode.co n1('MIXED_RETURN_TYPES', 44, "Methods and functions cannot use return both with and without values"); 3318 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode.co n1('MIXED_RETURN_TYPES', 45, "Methods and functions cannot use return both with and without values");
2863 3319
2864 /** 3320 /**
2865 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an abst ract class and 3321 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an abst ract class and
2866 * <i>q</i> is not a factory constructor. 3322 * <i>q</i> is not a factory constructor.
2867 */ 3323 */
2868 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = const StaticWarningCo de.con1('NEW_WITH_ABSTRACT_CLASS', 45, "Abstract classes cannot be created with a 'new' expression"); 3324 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = const StaticWarningCo de.con1('NEW_WITH_ABSTRACT_CLASS', 46, "Abstract classes cannot be created with a 'new' expression");
2869 3325
2870 /** 3326 /**
2871 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a stat ic warning. 3327 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a stat ic warning.
2872 * 3328 *
2873 * @param typeName the name of the type being referenced (<i>S</i>) 3329 * @param typeName the name of the type being referenced (<i>S</i>)
2874 * @param parameterCount the number of type parameters that were declared 3330 * @param parameterCount the number of type parameters that were declared
2875 * @param argumentCount the number of type arguments provided 3331 * @param argumentCount the number of type arguments provided
2876 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS 3332 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS
2877 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS 3333 * @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS
2878 */ 3334 */
2879 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = const Static WarningCode.con1('NEW_WITH_INVALID_TYPE_PARAMETERS', 46, "The type '%s' is decla red with %d type parameters, but %d type arguments were given"); 3335 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = const Static WarningCode.con1('NEW_WITH_INVALID_TYPE_PARAMETERS', 47, "The type '%s' is decla red with %d type parameters, but %d type arguments were given");
2880 3336
2881 /** 3337 /**
2882 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible i n the current scope, 3338 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible i n the current scope,
2883 * optionally followed by type arguments. 3339 * optionally followed by type arguments.
2884 * 3340 *
2885 * @param name the name of the non-type element 3341 * @param name the name of the non-type element
2886 */ 3342 */
2887 static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode.con 1('NEW_WITH_NON_TYPE', 47, "The name '%s' is not a class"); 3343 static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode.con 1('NEW_WITH_NON_TYPE', 48, "The name '%s' is not a class");
2888 3344
2889 /** 3345 /**
2890 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then: 3346 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then:
2891 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, &hellip;, a<sub>n< /sub>, 3347 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, &hellip;, a<sub>n< /sub>,
2892 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a 3348 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a
2893 * static warning if <i>T.id</i> is not the name of a constructor declared by the type <i>T</i>. 3349 * static warning if <i>T.id</i> is not the name of a constructor declared by the type <i>T</i>.
2894 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x< sub>n+1</sub>: 3350 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x< sub>n+1</sub>:
2895 * a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st atic warning if the 3351 * a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st atic warning if the
2896 * type <i>T</i> does not declare a constructor with the same name as the decl aration of <i>T</i>. 3352 * type <i>T</i> does not declare a constructor with the same name as the decl aration of <i>T</i>.
2897 */ 3353 */
2898 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = const StaticWa rningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR', 48, "The class '%s' does not ha ve a constructor '%s'"); 3354 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = const StaticWa rningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR', 49, "The class '%s' does not ha ve a constructor '%s'");
2899 3355
2900 /** 3356 /**
2901 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then: 3357 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then:
2902 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, &hellip;, a<sub>n< /sub>, 3358 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, &hellip;, a<sub>n< /sub>,
2903 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a 3359 * x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub >)</i> it is a
2904 * static warning if <i>T.id</i> is not the name of a constructor declared by the type <i>T</i>. 3360 * static warning if <i>T.id</i> is not the name of a constructor declared by the type <i>T</i>.
2905 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x< sub>n+1</sub>: 3361 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x< sub>n+1</sub>:
2906 * a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st atic warning if the 3362 * a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a st atic warning if the
2907 * type <i>T</i> does not declare a constructor with the same name as the decl aration of <i>T</i>. 3363 * type <i>T</i> does not declare a constructor with the same name as the decl aration of <i>T</i>.
2908 */ 3364 */
2909 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = const StaticWarningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 49, "The class '%s' does not have a default constructor"); 3365 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = const StaticWarningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 50, "The class '%s' does not have a default constructor");
2910 3366
2911 /** 3367 /**
2912 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an 3368 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
2913 * abstract method. 3369 * abstract method.
2914 * 3370 *
2915 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own 3371 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own
2916 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i> 3372 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i>
2917 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit 3373 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
2918 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. 3374 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
2919 * 3375 *
2920 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or 3376 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
2921 * inherited in a concrete class unless that member overrides a concrete one. 3377 * inherited in a concrete class unless that member overrides a concrete one.
2922 * 3378 *
2923 * @param memberName the name of the first member 3379 * @param memberName the name of the first member
2924 * @param memberName the name of the second member 3380 * @param memberName the name of the second member
2925 * @param memberName the name of the third member 3381 * @param memberName the name of the third member
2926 * @param memberName the name of the fourth member 3382 * @param memberName the name of the fourth member
2927 * @param additionalCount the number of additional missing members that aren't listed 3383 * @param additionalCount the number of additional missing members that aren't listed
2928 */ 3384 */
2929 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV E_PLUS = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMB ER_FIVE_PLUS', 50, "Missing concrete implementation of %s, %s, %s, %s and %d mor e"); 3385 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV E_PLUS = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMB ER_FIVE_PLUS', 51, "Missing concrete implementation of %s, %s, %s, %s and %d mor e");
2930 3386
2931 /** 3387 /**
2932 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an 3388 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
2933 * abstract method. 3389 * abstract method.
2934 * 3390 *
2935 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own 3391 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own
2936 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i> 3392 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i>
2937 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit 3393 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
2938 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. 3394 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
2939 * 3395 *
2940 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or 3396 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
2941 * inherited in a concrete class unless that member overrides a concrete one. 3397 * inherited in a concrete class unless that member overrides a concrete one.
2942 * 3398 *
2943 * @param memberName the name of the first member 3399 * @param memberName the name of the first member
2944 * @param memberName the name of the second member 3400 * @param memberName the name of the second member
2945 * @param memberName the name of the third member 3401 * @param memberName the name of the third member
2946 * @param memberName the name of the fourth member 3402 * @param memberName the name of the fourth member
2947 */ 3403 */
2948 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU R = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FO UR', 51, "Missing concrete implementation of %s, %s, %s and %s"); 3404 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU R = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FO UR', 52, "Missing concrete implementation of %s, %s, %s and %s");
2949 3405
2950 /** 3406 /**
2951 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an 3407 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
2952 * abstract method. 3408 * abstract method.
2953 * 3409 *
2954 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own 3410 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own
2955 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i> 3411 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i>
2956 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit 3412 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
2957 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. 3413 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
2958 * 3414 *
2959 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or 3415 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
2960 * inherited in a concrete class unless that member overrides a concrete one. 3416 * inherited in a concrete class unless that member overrides a concrete one.
2961 * 3417 *
2962 * @param memberName the name of the member 3418 * @param memberName the name of the member
2963 */ 3419 */
2964 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE ', 52, "Missing concrete implementation of %s"); 3420 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE ', 53, "Missing concrete implementation of %s");
2965 3421
2966 /** 3422 /**
2967 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an 3423 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
2968 * abstract method. 3424 * abstract method.
2969 * 3425 *
2970 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own 3426 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own
2971 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i> 3427 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i>
2972 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit 3428 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
2973 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. 3429 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
2974 * 3430 *
2975 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or 3431 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
2976 * inherited in a concrete class unless that member overrides a concrete one. 3432 * inherited in a concrete class unless that member overrides a concrete one.
2977 * 3433 *
2978 * @param memberName the name of the first member 3434 * @param memberName the name of the first member
2979 * @param memberName the name of the second member 3435 * @param memberName the name of the second member
2980 * @param memberName the name of the third member 3436 * @param memberName the name of the third member
2981 */ 3437 */
2982 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR EE = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_T HREE', 53, "Missing concrete implementation of %s, %s and %s"); 3438 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR EE = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_T HREE', 54, "Missing concrete implementation of %s, %s and %s");
2983 3439
2984 /** 3440 /**
2985 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an 3441 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
2986 * abstract method. 3442 * abstract method.
2987 * 3443 *
2988 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own 3444 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declar e its own
2989 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i> 3445 * <i>noSuchMethod()</i> method. It is a static warning if the implicit interf ace of <i>C</i>
2990 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit 3446 * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
2991 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. 3447 * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
2992 * 3448 *
2993 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or 3449 * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
2994 * inherited in a concrete class unless that member overrides a concrete one. 3450 * inherited in a concrete class unless that member overrides a concrete one.
2995 * 3451 *
2996 * @param memberName the name of the first member 3452 * @param memberName the name of the first member
2997 * @param memberName the name of the second member 3453 * @param memberName the name of the second member
2998 */ 3454 */
2999 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO ', 54, "Missing concrete implementation of %s and %s"); 3455 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = const StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO ', 55, "Missing concrete implementation of %s and %s");
3000 3456
3001 /** 3457 /**
3002 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<s ub>2</sub>) s</i> or 3458 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<s ub>2</sub>) s</i> or
3003 * <i>on T s</i> matches an object <i>o</i> if the type of <i>o</i> is a subty pe of <i>T</i>. It 3459 * <i>on T s</i> matches an object <i>o</i> if the type of <i>o</i> is a subty pe of <i>T</i>. It
3004 * is a static warning if <i>T</i> does not denote a type available in the lex ical scope of the 3460 * is a static warning if <i>T</i> does not denote a type available in the lex ical scope of the
3005 * catch clause. 3461 * catch clause.
3006 * 3462 *
3007 * @param name the name of the non-type element 3463 * @param name the name of the non-type element
3008 */ 3464 */
3009 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = const StaticWarningC ode.con1('NON_TYPE_IN_CATCH_CLAUSE', 55, "The name '%s' is not a type and cannot be used in an on-catch clause"); 3465 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = const StaticWarningC ode.con1('NON_TYPE_IN_CATCH_CLAUSE', 56, "The name '%s' is not a type and cannot be used in an on-catch clause");
3010 3466
3011 /** 3467 /**
3012 * 7.1.1 Operators: It is a static warning if the return type of the user-decl ared operator []= is 3468 * 7.1.1 Operators: It is a static warning if the return type of the user-decl ared operator []= is
3013 * explicitly declared and not void. 3469 * explicitly declared and not void.
3014 */ 3470 */
3015 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = const StaticWarn ingCode.con1('NON_VOID_RETURN_FOR_OPERATOR', 56, "The return type of the operato r []= must be 'void'"); 3471 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = const StaticWarn ingCode.con1('NON_VOID_RETURN_FOR_OPERATOR', 57, "The return type of the operato r []= must be 'void'");
3016 3472
3017 /** 3473 /**
3018 * 7.3 Setters: It is a static warning if a setter declares a return type othe r than void. 3474 * 7.3 Setters: It is a static warning if a setter declares a return type othe r than void.
3019 */ 3475 */
3020 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = const StaticWarnin gCode.con1('NON_VOID_RETURN_FOR_SETTER', 57, "The return type of the setter must be 'void'"); 3476 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = const StaticWarnin gCode.con1('NON_VOID_RETURN_FOR_SETTER', 58, "The return type of the setter must be 'void'");
3021 3477
3022 /** 3478 /**
3023 * 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the for m <i>id</i> or the 3479 * 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the for m <i>id</i> or the
3024 * form <i>prefix.id</i>, and in the enclosing lexical scope, the name <i>id</ i> (respectively 3480 * form <i>prefix.id</i>, and in the enclosing lexical scope, the name <i>id</ i> (respectively
3025 * <i>prefix.id</i>) does not denote a type. * <i>T</i> denotes a type paramet er in the 3481 * <i>prefix.id</i>) does not denote a type. * <i>T</i> denotes a type paramet er in the
3026 * enclosing lexical scope, but occurs in the signature or body of a static me mber. * 3482 * enclosing lexical scope, but occurs in the signature or body of a static me mber. *
3027 * <i>T</i> is a parameterized type of the form <i>G&lt;S<sub>1</sub>, .., S<s ub>n</sub>&gt;</i>, 3483 * <i>T</i> is a parameterized type of the form <i>G&lt;S<sub>1</sub>, .., S<s ub>n</sub>&gt;</i>,
3028 * 3484 *
3029 * Any use of a malformed type gives rise to a static warning. 3485 * Any use of a malformed type gives rise to a static warning.
3030 * 3486 *
3031 * @param nonTypeName the name that is not a type 3487 * @param nonTypeName the name that is not a type
3032 */ 3488 */
3033 static const StaticWarningCode NOT_A_TYPE = const StaticWarningCode.con1('NOT_ A_TYPE', 58, "%s is not a type"); 3489 static const StaticWarningCode NOT_A_TYPE = const StaticWarningCode.con1('NOT_ A_TYPE', 59, "%s is not a type");
3034 3490
3035 /** 3491 /**
3036 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt; h</ i> or if <i>m &gt; 3492 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt; h</ i> or if <i>m &gt;
3037 * n</i>. 3493 * n</i>.
3038 * 3494 *
3039 * @param requiredCount the expected number of required arguments 3495 * @param requiredCount the expected number of required arguments
3040 * @param argumentCount the actual number of positional arguments given 3496 * @param argumentCount the actual number of positional arguments given
3041 * @see #EXTRA_POSITIONAL_ARGUMENTS 3497 * @see #EXTRA_POSITIONAL_ARGUMENTS
3042 */ 3498 */
3043 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const StaticWar ningCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 59, "%d required argument(s) expe cted, but %d found"); 3499 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = const StaticWar ningCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 60, "%d required argument(s) expe cted, but %d found");
3044 3500
3045 /** 3501 /**
3046 * 14.3 Parts: It is a static warning if the referenced part declaration <i>p< /i> names a library 3502 * 14.3 Parts: It is a static warning if the referenced part declaration <i>p< /i> names a library
3047 * other than the current library as the library to which <i>p</i> belongs. 3503 * other than the current library as the library to which <i>p</i> belongs.
3048 * 3504 *
3049 * @param expectedLibraryName the name of expected library name 3505 * @param expectedLibraryName the name of expected library name
3050 * @param actualLibraryName the non-matching actual library name from the "par t of" declaration 3506 * @param actualLibraryName the non-matching actual library name from the "par t of" declaration
3051 */ 3507 */
3052 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = const StaticWarning Code.con1('PART_OF_DIFFERENT_LIBRARY', 60, "Expected this library to be part of '%s', not '%s'"); 3508 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = const StaticWarning Code.con1('PART_OF_DIFFERENT_LIBRARY', 61, "Expected this library to be part of '%s', not '%s'");
3053 3509
3054 /** 3510 /**
3055 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i s not a subtype of 3511 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i s not a subtype of
3056 * the type of <i>k</i>. 3512 * the type of <i>k</i>.
3057 * 3513 *
3058 * @param redirectedName the name of the redirected constructor 3514 * @param redirectedName the name of the redirected constructor
3059 * @param redirectingName the name of the redirecting constructor 3515 * @param redirectingName the name of the redirecting constructor
3060 */ 3516 */
3061 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = const Stati cWarningCode.con1('REDIRECT_TO_INVALID_FUNCTION_TYPE', 61, "The redirected const ructor '%s' has incompatible parameters with '%s'"); 3517 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = const Stati cWarningCode.con1('REDIRECT_TO_INVALID_FUNCTION_TYPE', 62, "The redirected const ructor '%s' has incompatible parameters with '%s'");
3062 3518
3063 /** 3519 /**
3064 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i s not a subtype of 3520 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> i s not a subtype of
3065 * the type of <i>k</i>. 3521 * the type of <i>k</i>.
3066 * 3522 *
3067 * @param redirectedName the name of the redirected constructor return type 3523 * @param redirectedName the name of the redirected constructor return type
3068 * @param redirectingName the name of the redirecting constructor return type 3524 * @param redirectingName the name of the redirecting constructor return type
3069 */ 3525 */
3070 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = const StaticW arningCode.con1('REDIRECT_TO_INVALID_RETURN_TYPE', 62, "The return type '%s' of the redirected constructor is not assignable to '%s'"); 3526 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = const StaticW arningCode.con1('REDIRECT_TO_INVALID_RETURN_TYPE', 63, "The return type '%s' of the redirected constructor is not assignable to '%s'");
3071 3527
3072 /** 3528 /**
3073 * 7.6.2 Factories: It is a static warning if type does not denote a class acc essible in the 3529 * 7.6.2 Factories: It is a static warning if type does not denote a class acc essible in the
3074 * current scope; if type does denote such a class <i>C</i> it is a static war ning if the 3530 * current scope; if type does denote such a class <i>C</i> it is a static war ning if the
3075 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const ructor of <i>C</i>. 3531 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const ructor of <i>C</i>.
3076 */ 3532 */
3077 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = const StaticW arningCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 63, "The constructor '%s' cou ld not be found in '%s'"); 3533 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = const StaticW arningCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 64, "The constructor '%s' cou ld not be found in '%s'");
3078 3534
3079 /** 3535 /**
3080 * 7.6.2 Factories: It is a static warning if type does not denote a class acc essible in the 3536 * 7.6.2 Factories: It is a static warning if type does not denote a class acc essible in the
3081 * current scope; if type does denote such a class <i>C</i> it is a static war ning if the 3537 * current scope; if type does denote such a class <i>C</i> it is a static war ning if the
3082 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const ructor of <i>C</i>. 3538 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const ructor of <i>C</i>.
3083 */ 3539 */
3084 static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode .con1('REDIRECT_TO_NON_CLASS', 64, "The name '%s' is not a type and cannot be us ed in a redirected constructor"); 3540 static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode .con1('REDIRECT_TO_NON_CLASS', 65, "The name '%s' is not a type and cannot be us ed in a redirected constructor");
3085 3541
3086 /** 3542 /**
3087 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return s tatement of the form 3543 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return s tatement of the form
3088 * <i>return;</i> It is a static warning if both of the following conditions h old: 3544 * <i>return;</i> It is a static warning if both of the following conditions h old:
3089 * <ol> 3545 * <ol>
3090 * * <i>f</i> is not a generative constructor. 3546 * * <i>f</i> is not a generative constructor.
3091 * * The return type of <i>f</i> may not be assigned to void. 3547 * * The return type of <i>f</i> may not be assigned to void.
3092 * </ol> 3548 * </ol>
3093 */ 3549 */
3094 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode. con1('RETURN_WITHOUT_VALUE', 65, "Missing return value after 'return'"); 3550 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode. con1('RETURN_WITHOUT_VALUE', 66, "Missing return value after 'return'");
3095 3551
3096 /** 3552 /**
3097 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl are a static method 3553 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl are a static method
3098 * or getter <i>m</i>. 3554 * or getter <i>m</i>.
3099 * 3555 *
3100 * @param memberName the name of the instance member 3556 * @param memberName the name of the instance member
3101 */ 3557 */
3102 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = const Static WarningCode.con1('STATIC_ACCESS_TO_INSTANCE_MEMBER', 66, "Instance member '%s' c annot be accessed using static access"); 3558 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = const Static WarningCode.con1('STATIC_ACCESS_TO_INSTANCE_MEMBER', 67, "Instance member '%s' c annot be accessed using static access");
3103 3559
3104 /** 3560 /**
3105 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be assi gned to the type of 3561 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be assi gned to the type of
3106 * <i>e<sub>k</sub></i>. 3562 * <i>e<sub>k</sub></i>.
3107 */ 3563 */
3108 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = const Static WarningCode.con1('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 67, "Type '%s' of the switc h expression is not assignable to the type '%s' of case expressions"); 3564 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = const Static WarningCode.con1('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 68, "Type '%s' of the switc h expression is not assignable to the type '%s' of case expressions");
3565
3566 /**
3567 * 15.1 Static Types: It is a static warning to use a deferred type in a type annotation.
3568 *
3569 * @param name the name of the type that is deferred and being used in a type annotation
3570 */
3571 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = const StaticWa rningCode.con1('TYPE_ANNOTATION_DEFERRED_CLASS', 69, "The deferred type '%s' can not be used in a declaration");
3109 3572
3110 /** 3573 /**
3111 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type available in the 3574 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type available in the
3112 * current lexical scope. 3575 * current lexical scope.
3113 */ 3576 */
3114 static const StaticWarningCode TYPE_TEST_NON_TYPE = const StaticWarningCode.co n1('TYPE_TEST_NON_TYPE', 68, "The name '%s' is not a type and cannot be used in an 'is' expression"); 3577 static const StaticWarningCode TYPE_TEST_NON_TYPE = const StaticWarningCode.co n1('TYPE_TEST_NON_TYPE', 70, "The name '%s' is not a type and cannot be used in an 'is' expression");
3115 3578
3116 /** 3579 /**
3117 * 10 Generics: However, a type parameter is considered to be a malformed type when referenced by 3580 * 10 Generics: However, a type parameter is considered to be a malformed type when referenced by
3118 * a static member. 3581 * a static member.
3119 * 3582 *
3120 * 15.1 Static Types: Any use of a malformed type gives rise to a static warni ng. A malformed type 3583 * 15.1 Static Types: Any use of a malformed type gives rise to a static warni ng. A malformed type
3121 * is then interpreted as dynamic by the static type checker and the runtime. 3584 * is then interpreted as dynamic by the static type checker and the runtime.
3122 */ 3585 */
3123 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = const Sta ticWarningCode.con1('TYPE_PARAMETER_REFERENCED_BY_STATIC', 69, "Static members c annot reference type parameters"); 3586 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = const Sta ticWarningCode.con1('TYPE_PARAMETER_REFERENCED_BY_STATIC', 71, "Static members c annot reference type parameters");
3124 3587
3125 /** 3588 /**
3126 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form 3589 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form
3127 * <i>C.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</ sub>, &hellip; 3590 * <i>C.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</ sub>, &hellip;
3128 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static warning if <i>C</i> d oes not denote a 3591 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static warning if <i>C</i> d oes not denote a
3129 * class in the current scope. 3592 * class in the current scope.
3130 * 3593 *
3131 * @param undefinedClassName the name of the undefined class 3594 * @param undefinedClassName the name of the undefined class
3132 */ 3595 */
3133 static const StaticWarningCode UNDEFINED_CLASS = const StaticWarningCode.con1( 'UNDEFINED_CLASS', 70, "Undefined class '%s'"); 3596 static const StaticWarningCode UNDEFINED_CLASS = const StaticWarningCode.con1( 'UNDEFINED_CLASS', 72, "Undefined class '%s'");
3134 3597
3135 /** 3598 /**
3136 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". 3599 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool".
3137 */ 3600 */
3138 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = const StaticWarningCo de.con1('UNDEFINED_CLASS_BOOLEAN', 71, "Undefined class 'boolean'; did you mean 'bool'?"); 3601 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = const StaticWarningCo de.con1('UNDEFINED_CLASS_BOOLEAN', 73, "Undefined class 'boolean'; did you mean 'bool'?");
3139 3602
3140 /** 3603 /**
3141 * 12.17 Getter Invocation: It is a static warning if there is no class <i>C</ i> in the enclosing 3604 * 12.17 Getter Invocation: It is a static warning if there is no class <i>C</ i> in the enclosing
3142 * lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or e xplicitly, a getter 3605 * lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or e xplicitly, a getter
3143 * named <i>m</i>. 3606 * named <i>m</i>.
3144 * 3607 *
3145 * @param getterName the name of the getter 3608 * @param getterName the name of the getter
3146 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for 3609 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for
3147 */ 3610 */
3148 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode.con1 ('UNDEFINED_GETTER', 72, "There is no such getter '%s' in '%s'"); 3611 static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode.con1 ('UNDEFINED_GETTER', 74, "There is no such getter '%s' in '%s'");
3149 3612
3150 /** 3613 /**
3151 * 12.30 Identifier Reference: It is as static warning if an identifier expres sion of the form 3614 * 12.30 Identifier Reference: It is as static warning if an identifier expres sion of the form
3152 * <i>id</i> occurs inside a top level or static function (be it function, met hod, getter, or 3615 * <i>id</i> occurs inside a top level or static function (be it function, met hod, getter, or
3153 * setter) or variable initializer and there is no declaration <i>d</i> with n ame <i>id</i> in the 3616 * setter) or variable initializer and there is no declaration <i>d</i> with n ame <i>id</i> in the
3154 * lexical scope enclosing the expression. 3617 * lexical scope enclosing the expression.
3155 * 3618 *
3156 * @param name the name of the identifier 3619 * @param name the name of the identifier
3157 */ 3620 */
3158 static const StaticWarningCode UNDEFINED_IDENTIFIER = const StaticWarningCode. con1('UNDEFINED_IDENTIFIER', 73, "Undefined name '%s'"); 3621 static const StaticWarningCode UNDEFINED_IDENTIFIER = const StaticWarningCode. con1('UNDEFINED_IDENTIFIER', 75, "Undefined name '%s'");
3159 3622
3160 /** 3623 /**
3161 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>, 3624 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
3162 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i > &hellip; 3625 * must have a corresponding named parameter in the set {<i>p<sub>n+1</sub></i > &hellip;
3163 * <i>p<sub>n+k</sub></i>} or a static warning occurs. 3626 * <i>p<sub>n+k</sub></i>} or a static warning occurs.
3164 * 3627 *
3165 * @param name the name of the requested named parameter 3628 * @param name the name of the requested named parameter
3166 */ 3629 */
3167 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = const StaticWarning Code.con1('UNDEFINED_NAMED_PARAMETER', 74, "The named parameter '%s' is not defi ned"); 3630 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = const StaticWarning Code.con1('UNDEFINED_NAMED_PARAMETER', 76, "The named parameter '%s' is not defi ned");
3168 3631
3169 /** 3632 /**
3170 * 12.18 Assignment: It is as static warning if an assignment of the form <i>v = e</i> occurs 3633 * 12.18 Assignment: It is as static warning if an assignment of the form <i>v = e</i> occurs
3171 * inside a top level or static function (be it function, method, getter, or s etter) or variable 3634 * inside a top level or static function (be it function, method, getter, or s etter) or variable
3172 * initializer and there is no declaration <i>d</i> with name <i>v=</i> in the lexical scope 3635 * initializer and there is no declaration <i>d</i> with name <i>v=</i> in the lexical scope
3173 * enclosing the assignment. 3636 * enclosing the assignment.
3174 * 3637 *
3175 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in t he enclosing lexical 3638 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in t he enclosing lexical
3176 * scope of the assignment, or if <i>C</i> does not declare, implicitly or exp licitly, a setter 3639 * scope of the assignment, or if <i>C</i> does not declare, implicitly or exp licitly, a setter
3177 * <i>v=</i>. 3640 * <i>v=</i>.
3178 * 3641 *
3179 * @param setterName the name of the getter 3642 * @param setterName the name of the getter
3180 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for 3643 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for
3181 */ 3644 */
3182 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode.con1 ('UNDEFINED_SETTER', 75, "There is no such setter '%s' in '%s'"); 3645 static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode.con1 ('UNDEFINED_SETTER', 77, "There is no such setter '%s' in '%s'");
3183 3646
3184 /** 3647 /**
3185 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl are a static method 3648 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not decl are a static method
3186 * or getter <i>m</i>. 3649 * or getter <i>m</i>.
3187 * 3650 *
3188 * @param methodName the name of the method 3651 * @param methodName the name of the method
3189 * @param enclosingType the name of the enclosing type where the method is bei ng looked for 3652 * @param enclosingType the name of the enclosing type where the method is bei ng looked for
3190 */ 3653 */
3191 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = const Stati cWarningCode.con1('UNDEFINED_STATIC_METHOD_OR_GETTER', 76, "There is no such sta tic method, getter or setter '%s' in '%s'"); 3654 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = const Stati cWarningCode.con1('UNDEFINED_STATIC_METHOD_OR_GETTER', 78, "There is no such sta tic method, getter or setter '%s' in '%s'");
3192 3655
3193 /** 3656 /**
3194 * 7.2 Getters: It is a static warning if the return type of a getter is void. 3657 * 7.2 Getters: It is a static warning if the return type of a getter is void.
3195 */ 3658 */
3196 static const StaticWarningCode VOID_RETURN_FOR_GETTER = const StaticWarningCod e.con1('VOID_RETURN_FOR_GETTER', 77, "The return type of the getter must not be 'void'"); 3659 static const StaticWarningCode VOID_RETURN_FOR_GETTER = const StaticWarningCod e.con1('VOID_RETURN_FOR_GETTER', 79, "The return type of the getter must not be 'void'");
3197 3660
3198 static const List<StaticWarningCode> values = const [ 3661 static const List<StaticWarningCode> values = const [
3199 AMBIGUOUS_IMPORT, 3662 AMBIGUOUS_IMPORT,
3200 ARGUMENT_TYPE_NOT_ASSIGNABLE, 3663 ARGUMENT_TYPE_NOT_ASSIGNABLE,
3201 ASSIGNMENT_TO_CONST, 3664 ASSIGNMENT_TO_CONST,
3202 ASSIGNMENT_TO_FINAL, 3665 ASSIGNMENT_TO_FINAL,
3203 ASSIGNMENT_TO_METHOD, 3666 ASSIGNMENT_TO_METHOD,
3204 CASE_BLOCK_NOT_TERMINATED, 3667 CASE_BLOCK_NOT_TERMINATED,
3205 CAST_TO_NON_TYPE, 3668 CAST_TO_NON_TYPE,
3206 CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, 3669 CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
3207 CONFLICTING_DART_IMPORT, 3670 CONFLICTING_DART_IMPORT,
3208 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, 3671 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER,
3209 CONFLICTING_INSTANCE_METHOD_SETTER, 3672 CONFLICTING_INSTANCE_METHOD_SETTER,
3210 CONFLICTING_INSTANCE_METHOD_SETTER2, 3673 CONFLICTING_INSTANCE_METHOD_SETTER2,
3211 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, 3674 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER,
3212 CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, 3675 CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER,
3213 CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER, 3676 CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER,
3214 CONST_WITH_ABSTRACT_CLASS, 3677 CONST_WITH_ABSTRACT_CLASS,
3215 EQUAL_KEYS_IN_MAP, 3678 EQUAL_KEYS_IN_MAP,
3216 EXPORT_DUPLICATED_LIBRARY_NAME, 3679 EXPORT_DUPLICATED_LIBRARY_NAME,
3217 EXTRA_POSITIONAL_ARGUMENTS, 3680 EXTRA_POSITIONAL_ARGUMENTS,
3218 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, 3681 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION,
3219 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, 3682 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR,
3220 FIELD_INITIALIZER_NOT_ASSIGNABLE, 3683 FIELD_INITIALIZER_NOT_ASSIGNABLE,
3221 FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, 3684 FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE,
3222 FINAL_NOT_INITIALIZED, 3685 FINAL_NOT_INITIALIZED,
3223 FUNCTION_WITHOUT_CALL, 3686 FUNCTION_WITHOUT_CALL,
3224 IMPORT_DUPLICATED_LIBRARY_NAME, 3687 IMPORT_DUPLICATED_LIBRARY_NAME,
3688 IMPORT_OF_NON_LIBRARY,
3225 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, 3689 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD,
3226 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, 3690 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC,
3227 INVALID_GETTER_OVERRIDE_RETURN_TYPE, 3691 INVALID_GETTER_OVERRIDE_RETURN_TYPE,
3228 INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, 3692 INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE,
3229 INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE, 3693 INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE,
3230 INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE, 3694 INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE,
3231 INVALID_METHOD_OVERRIDE_RETURN_TYPE, 3695 INVALID_METHOD_OVERRIDE_RETURN_TYPE,
3232 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED, 3696 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
3233 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL, 3697 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
3234 INVALID_OVERRIDE_NAMED, 3698 INVALID_OVERRIDE_NAMED,
(...skipping 22 matching lines...) Expand all
3257 NOT_A_TYPE, 3721 NOT_A_TYPE,
3258 NOT_ENOUGH_REQUIRED_ARGUMENTS, 3722 NOT_ENOUGH_REQUIRED_ARGUMENTS,
3259 PART_OF_DIFFERENT_LIBRARY, 3723 PART_OF_DIFFERENT_LIBRARY,
3260 REDIRECT_TO_INVALID_FUNCTION_TYPE, 3724 REDIRECT_TO_INVALID_FUNCTION_TYPE,
3261 REDIRECT_TO_INVALID_RETURN_TYPE, 3725 REDIRECT_TO_INVALID_RETURN_TYPE,
3262 REDIRECT_TO_MISSING_CONSTRUCTOR, 3726 REDIRECT_TO_MISSING_CONSTRUCTOR,
3263 REDIRECT_TO_NON_CLASS, 3727 REDIRECT_TO_NON_CLASS,
3264 RETURN_WITHOUT_VALUE, 3728 RETURN_WITHOUT_VALUE,
3265 STATIC_ACCESS_TO_INSTANCE_MEMBER, 3729 STATIC_ACCESS_TO_INSTANCE_MEMBER,
3266 SWITCH_EXPRESSION_NOT_ASSIGNABLE, 3730 SWITCH_EXPRESSION_NOT_ASSIGNABLE,
3731 TYPE_ANNOTATION_DEFERRED_CLASS,
3267 TYPE_TEST_NON_TYPE, 3732 TYPE_TEST_NON_TYPE,
3268 TYPE_PARAMETER_REFERENCED_BY_STATIC, 3733 TYPE_PARAMETER_REFERENCED_BY_STATIC,
3269 UNDEFINED_CLASS, 3734 UNDEFINED_CLASS,
3270 UNDEFINED_CLASS_BOOLEAN, 3735 UNDEFINED_CLASS_BOOLEAN,
3271 UNDEFINED_GETTER, 3736 UNDEFINED_GETTER,
3272 UNDEFINED_IDENTIFIER, 3737 UNDEFINED_IDENTIFIER,
3273 UNDEFINED_NAMED_PARAMETER, 3738 UNDEFINED_NAMED_PARAMETER,
3274 UNDEFINED_SETTER, 3739 UNDEFINED_SETTER,
3275 UNDEFINED_STATIC_METHOD_OR_GETTER, 3740 UNDEFINED_STATIC_METHOD_OR_GETTER,
3276 VOID_RETURN_FOR_GETTER]; 3741 VOID_RETURN_FOR_GETTER];
3277 3742
3278 /** 3743 /**
3279 * The template used to create the message to be displayed for this error. 3744 * The template used to create the message to be displayed for this error.
3280 */
3281 final String message;
3282
3283 /**
3284 * The template used to create the correction to be displayed for this error, or `null` if
3285 * there is no correction information for this error.
3286 */
3287 final String correction;
3288
3289 /**
3290 * Initialize a newly created error code to have the given message.
3291 *
3292 * @param message the message template used to create the message to be displa yed for the error
3293 */
3294 const StaticWarningCode.con1(String name, int ordinal, String message) : this. con2(name, ordinal, message, null);
3295
3296 /**
3297 * Initialize a newly created error code to have the given message and correct ion.
3298 *
3299 * @param message the template used to create the message to be displayed for the error
3300 * @param correction the template used to create the correction to be displaye d for the error
3301 */
3302 const StaticWarningCode.con2(String name, int ordinal, this.message, this.corr ection) : super(name, ordinal);
3303
3304 @override
3305 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity;
3306
3307 @override
3308 ErrorType get type => ErrorType.STATIC_WARNING;
3309 }
3310
3311 /**
3312 * The interface `AnalysisErrorListener` defines the behavior of objects that li sten for
3313 * [AnalysisError] being produced by the analysis engine.
3314 */
3315 abstract class AnalysisErrorListener {
3316 /**
3317 * An error listener that ignores errors that are reported to it.
3318 */
3319 static final AnalysisErrorListener NULL_LISTENER = new AnalysisErrorListener_N ULL_LISTENER();
3320
3321 /**
3322 * This method is invoked when an error has been found by the analysis engine.
3323 *
3324 * @param error the error that was just found (not `null`)
3325 */
3326 void onError(AnalysisError error);
3327 }
3328
3329 class AnalysisErrorListener_NULL_LISTENER implements AnalysisErrorListener {
3330 @override
3331 void onError(AnalysisError event) {
3332 }
3333 }
3334
3335 /**
3336 * The enumeration `HtmlWarningCode` defines the error codes used for warnings i n HTML files.
3337 * The convention for this class is for the name of the error code to indicate t he problem that
3338 * caused the error to be generated and for the error message to explain what is wrong and, when
3339 * appropriate, how the problem can be corrected.
3340 */
3341 class HtmlWarningCode extends Enum<HtmlWarningCode> implements ErrorCode {
3342 /**
3343 * An error code indicating that the value of the 'src' attribute of a Dart sc ript tag is not a
3344 * valid URI.
3345 *
3346 * @param uri the URI that is invalid
3347 */
3348 static const HtmlWarningCode INVALID_URI = const HtmlWarningCode.con1('INVALID _URI', 0, "Invalid URI syntax: '%s'");
3349
3350 /**
3351 * An error code indicating that the value of the 'src' attribute of a Dart sc ript tag references
3352 * a file that does not exist.
3353 *
3354 * @param uri the URI pointing to a non-existent file
3355 */
3356 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode.con1(' URI_DOES_NOT_EXIST', 1, "Target of URI does not exist: '%s'");
3357
3358 static const List<HtmlWarningCode> values = const [INVALID_URI, URI_DOES_NOT_E XIST];
3359
3360 /**
3361 * The template used to create the message to be displayed for this error.
3362 */
3363 final String message;
3364
3365 /**
3366 * The template used to create the correction to be displayed for this error, or `null` if
3367 * there is no correction information for this error.
3368 */
3369 final String correction;
3370
3371 /**
3372 * Initialize a newly created error code to have the given message.
3373 *
3374 * @param message the message template used to create the message to be displa yed for the error
3375 */
3376 const HtmlWarningCode.con1(String name, int ordinal, String message) : this.co n2(name, ordinal, message, null);
3377
3378 /**
3379 * Initialize a newly created error code to have the given message and correct ion.
3380 *
3381 * @param message the template used to create the message to be displayed for the error
3382 * @param correction the template used to create the correction to be displaye d for the error
3383 */
3384 const HtmlWarningCode.con2(String name, int ordinal, this.message, this.correc tion) : super(name, ordinal);
3385
3386 @override
3387 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
3388
3389 @override
3390 ErrorType get type => ErrorType.STATIC_WARNING;
3391 }
3392
3393 /**
3394 * The enumeration `StaticTypeWarningCode` defines the error codes used for stat ic type
3395 * warnings. The convention for this class is for the name of the error code to indicate the problem
3396 * that caused the error to be generated and for the error message to explain wh at is wrong and,
3397 * when appropriate, how the problem can be corrected.
3398 */
3399 class StaticTypeWarningCode extends Enum<StaticTypeWarningCode> implements Error Code {
3400 /**
3401 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose clas s implements the
3402 * built-in class <i>List&lt;E></i> is allocated.
3403 *
3404 * @param numTypeArgument the number of provided type arguments
3405 */
3406 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = const St aticTypeWarningCode.con1('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 0, "List literal re quires exactly one type arguments or none, but %d found");
3407
3408 /**
3409 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class implements the
3410 * built-in class <i>Map&lt;K, V></i> is allocated.
3411 *
3412 * @param numTypeArgument the number of provided type arguments
3413 */
3414 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = const Sta ticTypeWarningCode.con1('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 1, "Map literal requi res exactly two type arguments or none, but %d found");
3415
3416 /**
3417 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
3418 * warning if <i>T</i> does not have an accessible instance setter named <i>v= </i>.
3419 *
3420 * @see #UNDEFINED_SETTER
3421 */
3422 static const StaticTypeWarningCode INACCESSIBLE_SETTER = const StaticTypeWarni ngCode.con1('INACCESSIBLE_SETTER', 2, "");
3423
3424 /**
3425 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause m ultiple members
3426 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> with the same name <i>n</i> t hat would be
3427 * inherited (because identically named members existed in several superinterf aces) then at most
3428 * one member is inherited.
3429 *
3430 * If the static types <i>T<sub>1</sub>, &hellip;, T<sub>k</sub></i> of the me mbers
3431 * <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i> are not identical, then there must be a member
3432 * <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> &lt;: T<sub>i</sub>, 1 &lt; = x &lt;= k</i> for
3433 * all <i>i, 1 &lt;= i &lt;= k</i>, or a static type warning occurs. The membe r that is inherited
3434 * is <i>m<sub>x</sub></i>, if it exists; otherwise:
3435 * * Let <i>numberOfPositionals</i>(<i>f</i>) denote the number of positional parameters of a
3436 * function <i>f</i>, and let <i>numberOfRequiredParams</i>(<i>f</i>) denote t he number of
3437 * required parameters of a function <i>f</i>. Furthermore, let <i>s</i> denot e the set of all
3438 * named parameters of the <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></i>. Then let
3439 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i>
3440 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= i <= k.</i>
3441 * If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, with <i>r</i> r equired parameters
3442 * of type <b>dynamic</b>, <i>h</i> positional parameters of type <b>dynamic</ b>, named parameters
3443 * <i>s</i> of type <b>dynamic</b> and return type <b>dynamic</b>.
3444 * * Otherwise none of the members <i>m<sub>1</sub>, &hellip;, m<sub>k</sub></ i> is inherited.
3445 */
3446 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = const Sta ticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 3, "'%s' is inherited by at least two interfaces inconsistently, from %s");
3447
3448 /**
3449 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n ot have an
3450 * accessible (3.2) instance member named <i>m</i>.
3451 *
3452 * @param memberName the name of the static member
3453 * @see UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER
3454 */
3455 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = const St aticTypeWarningCode.con1('INSTANCE_ACCESS_TO_STATIC_MEMBER', 4, "Static member ' %s' cannot be accessed using instance access");
3456
3457 /**
3458 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i > may not be
3459 * assigned to the static type of <i>v</i>. The static type of the expression <i>v = e</i> is the
3460 * static type of <i>e</i>.
3461 *
3462 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i > may not be
3463 * assigned to the static type of <i>C.v</i>. The static type of the expressio n <i>C.v = e</i> is
3464 * the static type of <i>e</i>.
3465 *
3466 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
3467 * warning if the static type of <i>e<sub>2</sub></i> may not be assigned to < i>T</i>.
3468 *
3469 * @param rhsTypeName the name of the right hand side type
3470 * @param lhsTypeName the name of the left hand side type
3471 */
3472 static const StaticTypeWarningCode INVALID_ASSIGNMENT = const StaticTypeWarnin gCode.con1('INVALID_ASSIGNMENT', 5, "A value of type '%s' cannot be assigned to a variable of type '%s'");
3473
3474 /**
3475 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the form
3476 * <i>o.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</ sub>, &hellip;
3477 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>.
3478 *
3479 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if <i>T</i> does not
3480 * have an accessible instance member named <i>m</i>. If <i>T.m</i> exists, it is a static warning
3481 * if the type <i>F</i> of <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does
3482 * not exist, or if <i>F</i> is not a function type, the static type of <i>i</ i> is dynamic.
3483 *
3484 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> of <i>C.m</i> may
3485 * not be assigned to a function type.
3486 *
3487 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
3488 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip;
3489 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If <i>S.m</i> exists, it is a static warning if the type
3490 * <i>F</i> of <i>S.m</i> may not be assigned to a function type.
3491 *
3492 * @param nonFunctionIdentifier the name of the identifier that is not a funct ion type
3493 */
3494 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = const StaticTy peWarningCode.con1('INVOCATION_OF_NON_FUNCTION', 6, "'%s' is not a method");
3495
3496 /**
3497 * 12.14.4 Function Expression Invocation: A function expression invocation <i >i</i> has the form
3498 * <i>e<sub>f</sub>(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a <sub>n+1</sub>,
3499 * &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression.
3500 *
3501 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub> </i> may not be
3502 * assigned to a function type.
3503 */
3504 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = con st StaticTypeWarningCode.con1('INVOCATION_OF_NON_FUNCTION_EXPRESSION', 7, "Canno t invoke a non-function");
3505
3506 /**
3507 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s ub></i> may not be
3508 * assigned to bool.
3509 *
3510 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> may not be assigned
3511 * to bool.
3512 *
3513 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be assigned to bool.
3514 *
3515 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be assi gned to bool.
3516 */
3517 static const StaticTypeWarningCode NON_BOOL_CONDITION = const StaticTypeWarnin gCode.con1('NON_BOOL_CONDITION', 8, "Conditions must have a static type of 'bool '");
3518
3519 /**
3520 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not b e assigned to either
3521 * bool or () &rarr; bool
3522 */
3523 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = const StaticTypeWarni ngCode.con1('NON_BOOL_EXPRESSION', 9, "Assertions must be on either a 'bool' or '() -> bool'");
3524
3525 /**
3526 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the expr ession
3527 * <i>e</i>?<b>false<b> : <b>true</b>.
3528 *
3529 * 12.20 Conditional: It is a static type warning if the type of <i>e<sub>1</s ub></i> may not be
3530 * assigned to bool.
3531 */
3532 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = const Static TypeWarningCode.con1('NON_BOOL_NEGATION_EXPRESSION', 10, "Negation argument must have a static type of 'bool'");
3533
3534 /**
3535 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, 1 &lt;= i &lt;=
3536 * n</i> does not denote a type in the enclosing lexical scope.
3537 */
3538 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = const StaticTyp eWarningCode.con1('NON_TYPE_AS_TYPE_ARGUMENT', 11, "The name '%s' is not a type and cannot be used as a parameterized type");
3539
3540 /**
3541 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not b e assigned to the
3542 * declared return type of the immediately enclosing function.
3543 *
3544 * @param actualReturnType the return type as declared in the return statement
3545 * @param expectedReturnType the expected return type as defined by the method
3546 * @param methodName the name of the method
3547 */
3548 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = const StaticTypeWa rningCode.con1('RETURN_OF_INVALID_TYPE', 12, "The return type '%s' is not a '%s' , as defined by the method '%s'");
3549
3550 /**
3551 * 12.11 Instance Creation: It is a static type warning if any of the type arg uments to a
3552 * constructor of a generic type <i>G</i> invoked by a new expression or a con stant object
3553 * expression are not subtypes of the bounds of the corresponding formal type parameters of
3554 * <i>G</i>.
3555 *
3556 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member <i>m</ i> of <i>G</i>, then
3557 * the static type of the member <i>m</i> of <i>G&lt;A<sub>1</sub>, &hellip;,
3558 * A<sub>n</sub>&gt;</i> is <i>[A<sub>1</sub>, &hellip;, A<sub>n</sub>/T<sub>1 </sub>, &hellip;,
3559 * T<sub>n</sub>]S</i> where <i>T<sub>1</sub>, &hellip;, T<sub>n</sub></i> are the formal type
3560 * parameters of <i>G</i>. Let <i>B<sub>i</sub></i> be the bounds of <i>T<sub> i</sub>, 1 &lt;= i
3561 * &lt;= n</i>. It is a static type warning if <i>A<sub>i</sub></i> is not a s ubtype of
3562 * <i>[A<sub>1</sub>, &hellip;, A<sub>n</sub>/T<sub>1</sub>, &hellip;,
3563 * T<sub>n</sub>]B<sub>i</sub>, 1 &lt;= i &lt;= n</i>.
3564 *
3565 * 7.6.2 Factories: It is a static type warning if any of the type arguments t o <i>k'</i> are not
3566 * subtypes of the bounds of the corresponding formal type parameters of type.
3567 *
3568 * @param boundedTypeName the name of the type used in the instance creation t hat should be
3569 * limited by the bound as specified in the class declaration
3570 * @param boundingTypeName the name of the bounding type
3571 * @see #TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND
3572 */
3573 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = const S taticTypeWarningCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 13, "'%s' does no t extend '%s'");
3574
3575 /**
3576 * 10 Generics: It is a static type warning if a type parameter is a supertype of its upper bound.
3577 *
3578 * @param typeParameterName the name of the type parameter
3579 * @see #TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
3580 */
3581 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = con st StaticTypeWarningCode.con1('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', 14, "'%s' cannot be a supertype of its upper bound");
3582
3583 /**
3584 * 12.15.3 Unqualified Invocation: If there exists a lexically visible declara tion named
3585 * <i>id</i>, let <i>f<sub>id</sub></i> be the innermost such declaration. The n: [skip].
3586 * Otherwise, <i>f<sub>id</sub></i> is considered equivalent to the ordinary m ethod invocation
3587 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, <i>x <sub>n+1</sub></i> :
3588 * <i>a<sub>n+1</sub></i>, ..., <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i >).
3589 *
3590 * @param methodName the name of the method that is undefined
3591 */
3592 static const StaticTypeWarningCode UNDEFINED_FUNCTION = const StaticTypeWarnin gCode.con1('UNDEFINED_FUNCTION', 15, "The function '%s' is not defined");
3593
3594 /**
3595 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is a static type
3596 * warning if <i>T</i> does not have a getter named <i>m</i>.
3597 *
3598 * @param getterName the name of the getter
3599 * @param enclosingType the name of the enclosing type where the getter is bei ng looked for
3600 */
3601 static const StaticTypeWarningCode UNDEFINED_GETTER = const StaticTypeWarningC ode.con1('UNDEFINED_GETTER', 16, "There is no such getter '%s' in '%s'");
3602
3603 /**
3604 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I t is a static type
3605 * warning if <i>T</i> does not have an accessible instance member named <i>m< /i>.
3606 *
3607 * @param methodName the name of the method that is undefined
3608 * @param typeName the resolved type name that the method lookup is happening on
3609 */
3610 static const StaticTypeWarningCode UNDEFINED_METHOD = const StaticTypeWarningC ode.con1('UNDEFINED_METHOD', 17, "The method '%s' is not defined for the class ' %s'");
3611
3612 /**
3613 * 12.18 Assignment: Evaluation of an assignment of the form
3614 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is equiva lent to the
3615 * evaluation of the expression (a, i, e){a.[]=(i, e); return e;} (<i>e<sub>1< /sub></i>,
3616 * <i>e<sub>2</sub></i>, <i>e<sub>2</sub></i>).
3617 *
3618 * 12.29 Assignable Expressions: An assignable expression of the form
3619 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method invocat ion of the operator
3620 * method [] on <i>e<sub>1</sub></i> with argument <i>e<sub>2</sub></i>.
3621 *
3622 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. I t is a static type
3623 * warning if <i>T</i> does not have an accessible instance member named <i>m< /i>.
3624 *
3625 * @param operator the name of the operator
3626 * @param enclosingType the name of the enclosing type where the operator is b eing looked for
3627 */
3628 static const StaticTypeWarningCode UNDEFINED_OPERATOR = const StaticTypeWarnin gCode.con1('UNDEFINED_OPERATOR', 18, "There is no such operator '%s' in '%s'");
3629
3630 /**
3631 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
3632 * warning if <i>T</i> does not have an accessible instance setter named <i>v= </i>.
3633 *
3634 * @param setterName the name of the setter
3635 * @param enclosingType the name of the enclosing type where the setter is bei ng looked for
3636 * @see #INACCESSIBLE_SETTER
3637 */
3638 static const StaticTypeWarningCode UNDEFINED_SETTER = const StaticTypeWarningC ode.con1('UNDEFINED_SETTER', 19, "There is no such setter '%s' in '%s'");
3639
3640 /**
3641 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
3642 * <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n +1</sub>, &hellip;
3643 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static type warning if <i>S< /i> does not have an
3644 * accessible instance member named <i>m</i>.
3645 *
3646 * @param methodName the name of the method that is undefined
3647 * @param typeName the resolved type name that the method lookup is happening on
3648 */
3649 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = const StaticTypeWa rningCode.con1('UNDEFINED_SUPER_METHOD', 20, "There is no such method '%s' in '% s'");
3650
3651 /**
3652 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does n ot have an
3653 * accessible (3.2) instance member named <i>m</i>.
3654 *
3655 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used when we are
3656 * able to find the name defined in a supertype. It exists to provide a more i nformative error
3657 * message.
3658 */
3659 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M EMBER = const StaticTypeWarningCode.con1('UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STA TIC_MEMBER', 21, "Static members from supertypes must be qualified by the name o f the defining type");
3660
3661 /**
3662 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a generic type with
3663 * exactly <i>n</i> type parameters.
3664 *
3665 * @param typeName the name of the type being referenced (<i>G</i>)
3666 * @param parameterCount the number of type parameters that were declared
3667 * @param argumentCount the number of type arguments provided
3668 * @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS
3669 * @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS
3670 */
3671 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = const Stat icTypeWarningCode.con1('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 22, "The type '%s' is d eclared with %d type parameters, but %d type arguments were given");
3672
3673 static const List<StaticTypeWarningCode> values = const [
3674 EXPECTED_ONE_LIST_TYPE_ARGUMENTS,
3675 EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
3676 INACCESSIBLE_SETTER,
3677 INCONSISTENT_METHOD_INHERITANCE,
3678 INSTANCE_ACCESS_TO_STATIC_MEMBER,
3679 INVALID_ASSIGNMENT,
3680 INVOCATION_OF_NON_FUNCTION,
3681 INVOCATION_OF_NON_FUNCTION_EXPRESSION,
3682 NON_BOOL_CONDITION,
3683 NON_BOOL_EXPRESSION,
3684 NON_BOOL_NEGATION_EXPRESSION,
3685 NON_TYPE_AS_TYPE_ARGUMENT,
3686 RETURN_OF_INVALID_TYPE,
3687 TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
3688 TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
3689 UNDEFINED_FUNCTION,
3690 UNDEFINED_GETTER,
3691 UNDEFINED_METHOD,
3692 UNDEFINED_OPERATOR,
3693 UNDEFINED_SETTER,
3694 UNDEFINED_SUPER_METHOD,
3695 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
3696 WRONG_NUMBER_OF_TYPE_ARGUMENTS];
3697
3698 /**
3699 * The template used to create the message to be displayed for this error.
3700 */ 3745 */
3701 final String message; 3746 final String message;
3702 3747
3703 /** 3748 /**
3704 * The template used to create the correction to be displayed for this error, or `null` if 3749 * The template used to create the correction to be displayed for this error, or `null` if
3705 * there is no correction information for this error. 3750 * there is no correction information for this error.
3706 */ 3751 */
3707 final String correction; 3752 final String correction;
3708 3753
3709 /** 3754 /**
3710 * Initialize a newly created error code to have the given message. 3755 * Initialize a newly created error code to have the given message.
3711 * 3756 *
3712 * @param message the message template used to create the message to be displa yed for the error 3757 * @param message the message template used to create the message to be displa yed for the error
3713 */ 3758 */
3714 const StaticTypeWarningCode.con1(String name, int ordinal, String message) : t his.con2(name, ordinal, message, null); 3759 const StaticWarningCode.con1(String name, int ordinal, String message) : this. con2(name, ordinal, message, null);
3715 3760
3716 /** 3761 /**
3717 * Initialize a newly created error code to have the given message and correct ion. 3762 * Initialize a newly created error code to have the given message and correct ion.
3718 * 3763 *
3719 * @param message the template used to create the message to be displayed for the error 3764 * @param message the template used to create the message to be displayed for the error
3720 * @param correction the template used to create the correction to be displaye d for the error 3765 * @param correction the template used to create the correction to be displaye d for the error
3721 */ 3766 */
3722 const StaticTypeWarningCode.con2(String name, int ordinal, this.message, this. correction) : super(name, ordinal); 3767 const StaticWarningCode.con2(String name, int ordinal, this.message, this.corr ection) : super(name, ordinal);
3723 3768
3724 @override 3769 @override
3725 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; 3770 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity;
3726 3771
3727 @override 3772 @override
3728 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; 3773 ErrorType get type => ErrorType.STATIC_WARNING;
3774 }
3775
3776 /**
3777 * The enumeration `ErrorProperty` defines the properties that can be associated with an
3778 * [AnalysisError].
3779 */
3780 class ErrorProperty extends Enum<ErrorProperty> {
3781 /**
3782 * A property whose value is an array of [ExecutableElement] that should
3783 * be but are not implemented by a concrete class.
3784 */
3785 static const ErrorProperty UNIMPLEMENTED_METHODS = const ErrorProperty('UNIMPL EMENTED_METHODS', 0);
3786
3787 static const List<ErrorProperty> values = const [UNIMPLEMENTED_METHODS];
3788
3789 const ErrorProperty(String name, int ordinal) : super(name, ordinal);
3729 } 3790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698