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

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

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

Powered by Google App Engine
This is Rietveld 408576698