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