| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 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. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.error; | 4 library engine.error; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'source.dart'; | 7 import 'source.dart'; |
| 8 import 'ast.dart' show ASTNode; |
| 9 import 'scanner.dart' show Token; |
| 8 | 10 |
| 9 /** | 11 /** |
| 10 * Instances of the enumeration {@code ErrorType} represent the type of an {@lin
k ErrorCode}. | |
| 11 */ | |
| 12 class ErrorType { | |
| 13 /** | |
| 14 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported | |
| 15 * by a Dart compiler before the erroneous code is executed. | |
| 16 */ | |
| 17 static final ErrorType COMPILE_TIME_ERROR = new ErrorType('COMPILE_TIME_ERROR'
, 0, ErrorSeverity.ERROR); | |
| 18 /** | |
| 19 * Static warnings are those warnings reported by the static checker. They hav
e no effect on | |
| 20 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. | |
| 21 */ | |
| 22 static final ErrorType STATIC_WARNING = new ErrorType('STATIC_WARNING', 1, Err
orSeverity.WARNING); | |
| 23 /** | |
| 24 * Many, but not all, static warnings relate to types, in which case they are
known as static type | |
| 25 * warnings. | |
| 26 */ | |
| 27 static final ErrorType STATIC_TYPE_WARNING = new ErrorType('STATIC_TYPE_WARNIN
G', 2, ErrorSeverity.WARNING); | |
| 28 /** | |
| 29 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. | |
| 30 */ | |
| 31 static final ErrorType SYNTACTIC_ERROR = new ErrorType('SYNTACTIC_ERROR', 3, E
rrorSeverity.ERROR); | |
| 32 static final List<ErrorType> values = [COMPILE_TIME_ERROR, STATIC_WARNING, STA
TIC_TYPE_WARNING, SYNTACTIC_ERROR]; | |
| 33 final String __name; | |
| 34 final int __ordinal; | |
| 35 /** | |
| 36 * The severity of this type of error. | |
| 37 */ | |
| 38 ErrorSeverity _severity; | |
| 39 /** | |
| 40 * Initialize a newly created error type to have the given severity. | |
| 41 * @param severity the severity of this type of error | |
| 42 */ | |
| 43 ErrorType(this.__name, this.__ordinal, ErrorSeverity severity) { | |
| 44 this._severity = severity; | |
| 45 } | |
| 46 /** | |
| 47 * Return the severity of this type of error. | |
| 48 * @return the severity of this type of error | |
| 49 */ | |
| 50 ErrorSeverity get severity => _severity; | |
| 51 String toString() => __name; | |
| 52 } | |
| 53 /** | |
| 54 * The interface {@code ErrorCode} defines the behavior common to objects repres
enting error codes | |
| 55 * associated with {@link AnalysisError analysis errors}. | |
| 56 */ | |
| 57 abstract class ErrorCode { | |
| 58 /** | |
| 59 * Return the severity of this error. | |
| 60 * @return the severity of this error | |
| 61 */ | |
| 62 ErrorSeverity get errorSeverity; | |
| 63 /** | |
| 64 * Return the message template used to create the message to be displayed for
this error. | |
| 65 * @return the message template used to create the message to be displayed for
this error | |
| 66 */ | |
| 67 String get message; | |
| 68 /** | |
| 69 * Return the type of the error. | |
| 70 * @return the type of the error | |
| 71 */ | |
| 72 ErrorType get type; | |
| 73 /** | |
| 74 * Return {@code true} if this error should cause recompilation of the source
during the next | |
| 75 * incremental compilation. | |
| 76 * @return {@code true} if this error should cause recompilation of the source
during the next | |
| 77 * incremental compilation | |
| 78 */ | |
| 79 bool needsRecompilation(); | |
| 80 } | |
| 81 /** | |
| 82 * Instances of the enumeration {@code ErrorSeverity} represent the severity of
an {@link ErrorCode}. | 12 * Instances of the enumeration {@code ErrorSeverity} represent the severity of
an {@link ErrorCode}. |
| 83 */ | 13 */ |
| 84 class ErrorSeverity { | 14 class ErrorSeverity { |
| 85 /** | 15 /** |
| 86 * The severity representing an error. | 16 * The severity representing an error. |
| 87 */ | 17 */ |
| 88 static final ErrorSeverity ERROR = new ErrorSeverity('ERROR', 0, "E"); | 18 static final ErrorSeverity ERROR = new ErrorSeverity('ERROR', 0, "E"); |
| 89 /** | 19 /** |
| 90 * The severity representing a warning. Warnings can become errors if the {@co
de -Werror} command | 20 * The severity representing a warning. Warnings can become errors if the {@co
de -Werror} command |
| 91 * line flag is specified. | 21 * line flag is specified. |
| 92 */ | 22 */ |
| 93 static final ErrorSeverity WARNING = new ErrorSeverity('WARNING', 1, "W"); | 23 static final ErrorSeverity WARNING = new ErrorSeverity('WARNING', 1, "W"); |
| 94 static final List<ErrorSeverity> values = [ERROR, WARNING]; | 24 static final List<ErrorSeverity> values = [ERROR, WARNING]; |
| 95 final String __name; | 25 final String __name; |
| 96 final int __ordinal; | 26 final int __ordinal; |
| 97 String _name; | 27 String _name; |
| 98 ErrorSeverity(this.__name, this.__ordinal, String name) { | 28 ErrorSeverity(this.__name, this.__ordinal, String name) { |
| 99 this._name = name; | 29 this._name = name; |
| 100 } | 30 } |
| 101 String get name => _name; | 31 String get name => _name; |
| 102 String toString() => __name; | 32 String toString() => __name; |
| 103 } | 33 } |
| 104 /** | 34 /** |
| 105 * The interface {@code AnalysisErrorListener} defines the behavior of objects t
hat listen for{@link AnalysisError analysis errors} being produced by the analys
is engine. | 35 * Instances of the class {@code ErrorReporter} wrap an error listener with util
ity methods used to |
| 36 * create the errors being reported. |
| 106 */ | 37 */ |
| 107 abstract class AnalysisErrorListener { | 38 class ErrorReporter { |
| 108 /** | 39 /** |
| 109 * This method is invoked when an error has been found by the analysis engine. | 40 * The error listener to which errors will be reported. |
| 110 * @param error the error that was just found (not {@code null}) | |
| 111 */ | 41 */ |
| 112 void onError(AnalysisError error); | 42 AnalysisErrorListener _errorListener; |
| 43 /** |
| 44 * The default source to be used when reporting errors. |
| 45 */ |
| 46 Source _defaultSource; |
| 47 /** |
| 48 * The source to be used when reporting errors. |
| 49 */ |
| 50 Source _source; |
| 51 /** |
| 52 * Initialize a newly created error reporter that will report errors to the gi
ven listener. |
| 53 * @param errorListener the error listener to which errors will be reported |
| 54 * @param defaultSource the default source to be used when reporting errors |
| 55 */ |
| 56 ErrorReporter(AnalysisErrorListener errorListener, Source defaultSource) { |
| 57 if (errorListener == null) { |
| 58 throw new IllegalArgumentException("An error listener must be provided"); |
| 59 } else if (defaultSource == null) { |
| 60 throw new IllegalArgumentException("A default source must be provided"); |
| 61 } |
| 62 this._errorListener = errorListener; |
| 63 this._defaultSource = defaultSource; |
| 64 this._source = defaultSource; |
| 65 } |
| 66 /** |
| 67 * Report an error with the given error code and arguments. |
| 68 * @param errorCode the error code of the error to be reported |
| 69 * @param node the node specifying the location of the error |
| 70 * @param arguments the arguments to the error, used to compose the error mess
age |
| 71 */ |
| 72 void reportError(ErrorCode errorCode, ASTNode node, List<Object> arguments) { |
| 73 _errorListener.onError(new AnalysisError.con2(_source, node.offset, node.len
gth, errorCode, [arguments])); |
| 74 } |
| 75 /** |
| 76 * Report an error with the given error code and arguments. |
| 77 * @param errorCode the error code of the error to be reported |
| 78 * @param token the token specifying the location of the error |
| 79 * @param arguments the arguments to the error, used to compose the error mess
age |
| 80 */ |
| 81 void reportError2(ErrorCode errorCode, Token token, List<Object> arguments) { |
| 82 _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.l
ength, errorCode, [arguments])); |
| 83 } |
| 84 /** |
| 85 * Set the source to be used when reporting errors. Setting the source to {@co
de null} will cause |
| 86 * the default source to be used. |
| 87 * @param source the source to be used when reporting errors |
| 88 */ |
| 89 void set source(Source source7) { |
| 90 this._source = source7 == null ? _defaultSource : source7; |
| 91 } |
| 113 } | 92 } |
| 114 /** | 93 /** |
| 115 * Instances of the class {@code AnalysisError} represent an error discovered du
ring the analysis of | 94 * Instances of the class {@code AnalysisError} represent an error discovered du
ring the analysis of |
| 116 * some Dart code. | 95 * some Dart code. |
| 117 * @see AnalysisErrorListener | 96 * @see AnalysisErrorListener |
| 118 */ | 97 */ |
| 119 class AnalysisError { | 98 class AnalysisError { |
| 120 /** | 99 /** |
| 121 * An empty array of errors used when no errors are expected. | 100 * An empty array of errors used when no errors are expected. |
| 122 */ | 101 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 143 */ | 122 */ |
| 144 int _length = 0; | 123 int _length = 0; |
| 145 /** | 124 /** |
| 146 * Initialize a newly created analysis error for the specified source. The err
or has no location | 125 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 147 * information. | 126 * information. |
| 148 * @param source the source for which the exception occurred | 127 * @param source the source for which the exception occurred |
| 149 * @param errorCode the error code to be associated with this error | 128 * @param errorCode the error code to be associated with this error |
| 150 * @param arguments the arguments used to build the error message | 129 * @param arguments the arguments used to build the error message |
| 151 */ | 130 */ |
| 152 AnalysisError.con1(Source source2, ErrorCode errorCode2, List<Object> argument
s) { | 131 AnalysisError.con1(Source source2, ErrorCode errorCode2, List<Object> argument
s) { |
| 153 _jtd_constructor_122_impl(source2, errorCode2, arguments); | 132 _jtd_constructor_125_impl(source2, errorCode2, arguments); |
| 154 } | 133 } |
| 155 _jtd_constructor_122_impl(Source source2, ErrorCode errorCode2, List<Object> a
rguments) { | 134 _jtd_constructor_125_impl(Source source2, ErrorCode errorCode2, List<Object> a
rguments) { |
| 156 this._source = source2; | 135 this._source = source2; |
| 157 this._errorCode = errorCode2; | 136 this._errorCode = errorCode2; |
| 158 this._message = JavaString.format(errorCode2.message, arguments); | 137 this._message = JavaString.format(errorCode2.message, arguments); |
| 159 } | 138 } |
| 160 /** | 139 /** |
| 161 * Initialize a newly created analysis error for the specified source at the g
iven location. | 140 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 162 * @param source the source for which the exception occurred | 141 * @param source the source for which the exception occurred |
| 163 * @param offset the offset of the location of the error | 142 * @param offset the offset of the location of the error |
| 164 * @param length the length of the location of the error | 143 * @param length the length of the location of the error |
| 165 * @param errorCode the error code to be associated with this error | 144 * @param errorCode the error code to be associated with this error |
| 166 * @param arguments the arguments used to build the error message | 145 * @param arguments the arguments used to build the error message |
| 167 */ | 146 */ |
| 168 AnalysisError.con2(Source source3, int offset2, int length11, ErrorCode errorC
ode3, List<Object> arguments) { | 147 AnalysisError.con2(Source source3, int offset2, int length11, ErrorCode errorC
ode3, List<Object> arguments) { |
| 169 _jtd_constructor_123_impl(source3, offset2, length11, errorCode3, arguments)
; | 148 _jtd_constructor_126_impl(source3, offset2, length11, errorCode3, arguments)
; |
| 170 } | 149 } |
| 171 _jtd_constructor_123_impl(Source source3, int offset2, int length11, ErrorCode
errorCode3, List<Object> arguments) { | 150 _jtd_constructor_126_impl(Source source3, int offset2, int length11, ErrorCode
errorCode3, List<Object> arguments) { |
| 172 this._source = source3; | 151 this._source = source3; |
| 173 this._offset = offset2; | 152 this._offset = offset2; |
| 174 this._length = length11; | 153 this._length = length11; |
| 175 this._errorCode = errorCode3; | 154 this._errorCode = errorCode3; |
| 176 this._message = JavaString.format(errorCode3.message, arguments); | 155 this._message = JavaString.format(errorCode3.message, arguments); |
| 177 } | 156 } |
| 178 /** | 157 /** |
| 179 * Return the error code associated with the error. | 158 * Return the error code associated with the error. |
| 180 * @return the error code associated with the error | 159 * @return the error code associated with the error |
| 181 */ | 160 */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 210 } | 189 } |
| 211 /** | 190 /** |
| 212 * Set the source in which the error occurred to the given source. | 191 * Set the source in which the error occurred to the given source. |
| 213 * @param source the source in which the error occurred | 192 * @param source the source in which the error occurred |
| 214 */ | 193 */ |
| 215 void set source(Source source4) { | 194 void set source(Source source4) { |
| 216 this._source = source4; | 195 this._source = source4; |
| 217 } | 196 } |
| 218 String toString() { | 197 String toString() { |
| 219 StringBuffer builder = new StringBuffer(); | 198 StringBuffer builder = new StringBuffer(); |
| 220 builder.add((_source != null) ? _source.fullName : "<unknown source>"); | 199 builder.write((_source != null) ? _source.fullName : "<unknown source>"); |
| 221 builder.add("("); | 200 builder.write("("); |
| 222 builder.add(_offset); | 201 builder.write(_offset); |
| 223 builder.add(".."); | 202 builder.write(".."); |
| 224 builder.add(_offset + _length - 1); | 203 builder.write(_offset + _length - 1); |
| 225 builder.add("): "); | 204 builder.write("): "); |
| 226 builder.add(_message); | 205 builder.write(_message); |
| 227 return builder.toString(); | 206 return builder.toString(); |
| 228 } | 207 } |
| 229 } | 208 } |
| 209 /** |
| 210 * The interface {@code ErrorCode} defines the behavior common to objects repres
enting error codes |
| 211 * associated with {@link AnalysisError analysis errors}. |
| 212 */ |
| 213 abstract class ErrorCode { |
| 214 /** |
| 215 * Return the severity of this error. |
| 216 * @return the severity of this error |
| 217 */ |
| 218 ErrorSeverity get errorSeverity; |
| 219 /** |
| 220 * Return the message template used to create the message to be displayed for
this error. |
| 221 * @return the message template used to create the message to be displayed for
this error |
| 222 */ |
| 223 String get message; |
| 224 /** |
| 225 * Return the type of the error. |
| 226 * @return the type of the error |
| 227 */ |
| 228 ErrorType get type; |
| 229 /** |
| 230 * Return {@code true} if this error should cause recompilation of the source
during the next |
| 231 * incremental compilation. |
| 232 * @return {@code true} if this error should cause recompilation of the source
during the next |
| 233 * incremental compilation |
| 234 */ |
| 235 bool needsRecompilation(); |
| 236 } |
| 237 /** |
| 238 * Instances of the enumeration {@code ErrorType} represent the type of an {@lin
k ErrorCode}. |
| 239 */ |
| 240 class ErrorType { |
| 241 /** |
| 242 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported |
| 243 * by a Dart compiler before the erroneous code is executed. |
| 244 */ |
| 245 static final ErrorType COMPILE_TIME_ERROR = new ErrorType('COMPILE_TIME_ERROR'
, 0, ErrorSeverity.ERROR); |
| 246 /** |
| 247 * Static warnings are those warnings reported by the static checker. They hav
e no effect on |
| 248 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. |
| 249 */ |
| 250 static final ErrorType STATIC_WARNING = new ErrorType('STATIC_WARNING', 1, Err
orSeverity.WARNING); |
| 251 /** |
| 252 * Many, but not all, static warnings relate to types, in which case they are
known as static type |
| 253 * warnings. |
| 254 */ |
| 255 static final ErrorType STATIC_TYPE_WARNING = new ErrorType('STATIC_TYPE_WARNIN
G', 2, ErrorSeverity.WARNING); |
| 256 /** |
| 257 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
| 258 */ |
| 259 static final ErrorType SYNTACTIC_ERROR = new ErrorType('SYNTACTIC_ERROR', 3, E
rrorSeverity.ERROR); |
| 260 static final List<ErrorType> values = [COMPILE_TIME_ERROR, STATIC_WARNING, STA
TIC_TYPE_WARNING, SYNTACTIC_ERROR]; |
| 261 final String __name; |
| 262 final int __ordinal; |
| 263 /** |
| 264 * The severity of this type of error. |
| 265 */ |
| 266 ErrorSeverity _severity; |
| 267 /** |
| 268 * Initialize a newly created error type to have the given severity. |
| 269 * @param severity the severity of this type of error |
| 270 */ |
| 271 ErrorType(this.__name, this.__ordinal, ErrorSeverity severity) { |
| 272 this._severity = severity; |
| 273 } |
| 274 /** |
| 275 * Return the severity of this type of error. |
| 276 * @return the severity of this type of error |
| 277 */ |
| 278 ErrorSeverity get severity => _severity; |
| 279 String toString() => __name; |
| 280 } |
| 281 /** |
| 282 * The enumeration {@code CompileTimeErrorCode} defines the error codes used for
compile time |
| 283 * errors. The convention for this class is for the name of the error code to in
dicate the problem |
| 284 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 285 * when appropriate, how the problem can be corrected. |
| 286 */ |
| 287 class CompileTimeErrorCode implements ErrorCode { |
| 288 /** |
| 289 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported
by a library |
| 290 * <i>L</i> and <i>N</i> is introduced into the export namespace of <i>L</i> b
y more than one |
| 291 * export. |
| 292 */ |
| 293 static final CompileTimeErrorCode AMBIGUOUS_EXPORT = new CompileTimeErrorCode(
'AMBIGUOUS_EXPORT', 0, ""); |
| 294 /** |
| 295 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i
>N</i> is introduced |
| 296 * into the top level scope <i>L</i> by more than one import then: |
| 297 * <ol> |
| 298 * <li>It is a static warning if <i>N</i> is used as a type annotation. |
| 299 * <li>In checked mode, it is a dynamic error if <i>N</i> is used as a type an
notation and |
| 300 * referenced during a subtype test. |
| 301 * <li>Otherwise, it is a compile-time error. |
| 302 * </ol> |
| 303 */ |
| 304 static final CompileTimeErrorCode AMBIGUOUS_IMPORT = new CompileTimeErrorCode(
'AMBIGUOUS_IMPORT', 1, ""); |
| 305 /** |
| 306 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does
not denote a formal |
| 307 * parameter. |
| 308 * @param the name of the identifier in the argument definition test that is n
ot a parameter |
| 309 */ |
| 310 static final CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = new
CompileTimeErrorCode('ARGUMENT_DEFINITION_TEST_NON_PARAMETER', 2, "'%s' is not
a parameter"); |
| 311 /** |
| 312 * 12.30 Identifier Reference: It is a compile-time error to use a built-in id
entifier other than |
| 313 * dynamic as a type annotation. |
| 314 */ |
| 315 static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = new CompileTim
eErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', 3, ""); |
| 316 /** |
| 317 * 12.30 Identifier Reference: It is a compile-time error if a built-in identi
fier is used as the |
| 318 * declared name of a class, type parameter or type alias. |
| 319 */ |
| 320 static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new Compi
leTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, ""); |
| 321 /** |
| 322 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements th
e operator |
| 323 * <i>==</i>. |
| 324 */ |
| 325 static final CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = new
CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 5, ""); |
| 326 /** |
| 327 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time
constant would raise |
| 328 * an exception. |
| 329 */ |
| 330 static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new
CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 6, ""); |
| 331 /** |
| 332 * 7.6 Constructors: A constructor name always begins with the name of its imm
ediately enclosing |
| 333 * class, and may optionally be followed by a dot and an identifier <i>id</i>.
It is a |
| 334 * compile-time error if <i>id</i> is the name of a member declared in the imm
ediately enclosing |
| 335 * class. |
| 336 */ |
| 337 static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER = ne
w CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER', 7, ""); |
| 338 /** |
| 339 * 7.6.3 Constant Constructors: It is a compile-time error if a constant const
ructor is declared |
| 340 * by a class that has a non-final instance variable. |
| 341 */ |
| 342 static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new
CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 8, ""); |
| 343 /** |
| 344 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is
declared as a |
| 345 * constant variable. |
| 346 */ |
| 347 static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErro
rCode('CONST_FORMAL_PARAMETER', 9, ""); |
| 348 /** |
| 349 * 5 Variables: A constant variable must be initialized to a compile-time cons
tant or a |
| 350 * compile-time error occurs. |
| 351 */ |
| 352 static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE =
new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 10, ""); |
| 353 /** |
| 354 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec
t results in an |
| 355 * uncaught exception being thrown. |
| 356 */ |
| 357 static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTim
eErrorCode('CONST_EVAL_THROWS_EXCEPTION', 11, ""); |
| 358 /** |
| 359 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, &
hellip;, |
| 360 * U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time error if <i>S
</i> is not a |
| 361 * generic type with <i>m</i> type parameters. |
| 362 * @param typeName the name of the type being referenced (<i>S</i>) |
| 363 * @param argumentCount the number of type arguments provided |
| 364 * @param parameterCount the number of type parameters that were declared |
| 365 */ |
| 366 static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new Com
pileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 12, "The type '%s' is de
clared with %d type parameters, but %d type arguments were given"); |
| 367 /** |
| 368 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, &hellip
;, a<sub>n</sub>, |
| 369 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub
>)</i> it is a |
| 370 * compile-time error if the type <i>T</i> does not declare a constant constru
ctor with the same |
| 371 * name as the declaration of <i>T</i>. |
| 372 */ |
| 373 static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorC
ode('CONST_WITH_NON_CONST', 13, ""); |
| 374 /** |
| 375 * 12.11.2 Const: In all of the above cases, it is a compile-time error if <i>
a<sub>i</sub>, 1 |
| 376 * <= i <= n + k</i>, is not a compile-time constant expression. |
| 377 */ |
| 378 static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new Compi
leTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 14, ""); |
| 379 /** |
| 380 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class access
ible in the current |
| 381 * scope, optionally followed by type arguments. |
| 382 * <p> |
| 383 * 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>, |
| 384 * x<sub>n+1</sub>: a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>
)</i> it is a |
| 385 * compile-time error if <i>T</i> is not a class accessible in the current sco
pe, optionally |
| 386 * followed by type arguments. |
| 387 */ |
| 388 static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCo
de('CONST_WITH_NON_TYPE', 15, ""); |
| 389 /** |
| 390 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type par
ameters. |
| 391 */ |
| 392 static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTime
ErrorCode('CONST_WITH_TYPE_PARAMETERS', 16, ""); |
| 393 /** |
| 394 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
a constant |
| 395 * constructor declared by the type <i>T</i>. |
| 396 */ |
| 397 static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new Compi
leTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 17, ""); |
| 398 /** |
| 399 * 15.3.1 Typedef: It is a compile-time error if any default values are specif
ied in the signature |
| 400 * of a function type alias. |
| 401 */ |
| 402 static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new C
ompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 18, ""); |
| 403 /** |
| 404 * 3.1 Scoping: It is a compile-time error if there is more than one entity wi
th the same name |
| 405 * declared in the same scope. |
| 406 * @param duplicateName the name of the duplicate entity |
| 407 */ |
| 408 static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorC
ode('DUPLICATE_DEFINITION', 19, "The name '%s' is already defined"); |
| 409 /** |
| 410 * 7 Classes: It is a compile-time error if a class declares two members of th
e same name. |
| 411 */ |
| 412 static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeError
Code('DUPLICATE_MEMBER_NAME', 20, ""); |
| 413 /** |
| 414 * 7 Classes: It is a compile-time error if a class has an instance member and
a static member |
| 415 * with the same name. |
| 416 */ |
| 417 static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new
CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 21, ""); |
| 418 /** |
| 419 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub>
i</sub> = |
| 420 * q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the
label for a named |
| 421 * argument]. |
| 422 */ |
| 423 static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeEr
rorCode('DUPLICATE_NAMED_ARGUMENT', 22, ""); |
| 424 /** |
| 425 * 14.2 Exports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 426 * not a library declaration. |
| 427 */ |
| 428 static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeError
Code('EXPORT_OF_NON_LIBRARY', 23, ""); |
| 429 /** |
| 430 * 7.9 Superclasses: It is a compile-time error if the extends clause of a cla
ss <i>C</i> includes |
| 431 * a type expression that does not denote a class available in the lexical sco
pe of <i>C</i>. |
| 432 */ |
| 433 static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode
('EXTENDS_NON_CLASS', 24, ""); |
| 434 /** |
| 435 * 12.2 Null: It is a compile-time error for a class to attempt to extend or i
mplement Null. |
| 436 * <p> |
| 437 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement int. |
| 438 * <p> |
| 439 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend o
r implement double. |
| 440 * <p> |
| 441 * 12.3 Numbers: It is a compile-time error for any type other than the types
int and double to |
| 442 * attempt to extend or implement num. |
| 443 * <p> |
| 444 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend
or implement bool. |
| 445 * <p> |
| 446 * 12.5 Strings: It is a compile-time error for a class to attempt to extend o
r implement String. |
| 447 */ |
| 448 static final CompileTimeErrorCode EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS = new
CompileTimeErrorCode('EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS', 25, ""); |
| 449 /** |
| 450 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile time |
| 451 * error if more than one initializer corresponding to a given instance variab
le appears in |
| 452 * <i>k</i>’s list. |
| 453 */ |
| 454 static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS =
new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 26, ""); |
| 455 /** |
| 456 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile time |
| 457 * error if <i>k</i>’s initializer list contains an initializer for a final
variable <i>f</i> |
| 458 * whose declaration includes an initialization expression. |
| 459 */ |
| 460 static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARA
TION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATIO
N', 27, ""); |
| 461 /** |
| 462 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile time |
| 463 * error if <i>k</i>’s initializer list contains an initializer for a variab
le that is initialized |
| 464 * by means of an initializing formal of <i>k</i>. |
| 465 */ |
| 466 static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ
ER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
28, ""); |
| 467 /** |
| 468 * 7.6.1 Generative Constructors: It is a compile-time error if an initializin
g formal is used by |
| 469 * a function other than a non-redirecting generative constructor. |
| 470 */ |
| 471 static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new
CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 29, ""); |
| 472 /** |
| 473 * 5 Variables: It is a compile-time error if a final instance variable that h
as been initialized |
| 474 * at its point of declaration is also initialized in a constructor. |
| 475 */ |
| 476 static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRU
CTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTO
R', 30, ""); |
| 477 /** |
| 478 * 5 Variables: It is a compile-time error if a final instance variable that h
as is initialized by |
| 479 * means of an initializing formal of a constructor is also initialized elsewh
ere in the same |
| 480 * constructor. |
| 481 */ |
| 482 static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new Compi
leTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 31, ""); |
| 483 /** |
| 484 * 5 Variables: It is a compile-time error if a library, static or local varia
ble <i>v</i> is |
| 485 * final and <i>v</i> is not initialized at its point of declaration. |
| 486 */ |
| 487 static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeError
Code('FINAL_NOT_INITIALIZED', 32, ""); |
| 488 /** |
| 489 * 7.2 Getters: It is a compile-time error if a class has both a getter and a
method with the same |
| 490 * name. |
| 491 */ |
| 492 static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new Compi
leTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 33, ""); |
| 493 /** |
| 494 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o
f a class includes |
| 495 * type dynamic. |
| 496 */ |
| 497 static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCod
e('IMPLEMENTS_DYNAMIC', 34, ""); |
| 498 /** |
| 499 * 7.10 Superinterfaces: It is a compile-time error if the implements clause o
f a class <i>C</i> |
| 500 * includes a type expression that does not denote a class available in the le
xical scope of |
| 501 * <i>C</i>. |
| 502 */ |
| 503 static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorC
ode('IMPLEMENTS_NON_CLASS', 35, ""); |
| 504 /** |
| 505 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears
more than once in |
| 506 * the implements clause of a class. |
| 507 */ |
| 508 static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCo
de('IMPLEMENTS_REPEATED', 36, ""); |
| 509 /** |
| 510 * 7.10 Superinterfaces: It is a compile-time error if the interface of a clas
s <i>C</i> is a |
| 511 * superinterface of itself. |
| 512 */ |
| 513 static final CompileTimeErrorCode IMPLEMENTS_SELF = new CompileTimeErrorCode('
IMPLEMENTS_SELF', 37, ""); |
| 514 /** |
| 515 * 14.1 Imports: It is a compile-time error to import two different libraries
with the same name. |
| 516 */ |
| 517 static final CompileTimeErrorCode IMPORT_DUPLICATED_LIBRARY_NAME = new Compile
TimeErrorCode('IMPORT_DUPLICATED_LIBRARY_NAME', 38, ""); |
| 518 /** |
| 519 * 14.1 Imports: It is a compile-time error if the compilation unit found at t
he specified URI is |
| 520 * not a library declaration. |
| 521 */ |
| 522 static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeError
Code('IMPORT_OF_NON_LIBRARY', 39, ""); |
| 523 /** |
| 524 * 13.9 Switch: It is a compile-time error if values of the expressions <i>e<s
ub>k</sub></i> are |
| 525 * not instances of the same class <i>C</i>, for all <i>1 <= k <= n</i>. |
| 526 */ |
| 527 static final CompileTimeErrorCode INCONSITENT_CASE_EXPRESSION_TYPES = new Comp
ileTimeErrorCode('INCONSITENT_CASE_EXPRESSION_TYPES', 40, ""); |
| 528 /** |
| 529 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.
id</i>. It is a |
| 530 * compile-time error if <i>id</i> is not the name of an instance variable of
the immediately |
| 531 * enclosing class. |
| 532 */ |
| 533 static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new Com
pileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 41, ""); |
| 534 /** |
| 535 * 7.6 Constructors: It is a compile-time error if the name of a constructor i
s not a constructor |
| 536 * name. |
| 537 */ |
| 538 static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeEr
rorCode('INVALID_CONSTRUCTOR_NAME', 42, ""); |
| 539 /** |
| 540 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of
the immediately |
| 541 * enclosing class. |
| 542 */ |
| 543 static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new Compi
leTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 43, ""); |
| 544 /** |
| 545 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 546 * instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies
a default value for |
| 547 * a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a diff
erent default value |
| 548 * for <i>p</i>. |
| 549 */ |
| 550 static final CompileTimeErrorCode INVALID_OVERRIDE_DEFAULT_VALUE = new Compile
TimeErrorCode('INVALID_OVERRIDE_DEFAULT_VALUE', 44, ""); |
| 551 /** |
| 552 * 7.1: It is a compile-time error if an instance method <i>m1</i> overrides a
n instance member |
| 553 * <i>m2</i> and <i>m1</i> does not declare all the named parameters declared
by <i>m2</i>. |
| 554 */ |
| 555 static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErro
rCode('INVALID_OVERRIDE_NAMED', 45, ""); |
| 556 /** |
| 557 * 7.1 Instance Methods: It is a compile-time error if an instance method m1 o
verrides an instance |
| 558 * member <i>m2</i> and <i>m1</i> has fewer optional positional parameters tha
n <i>m2</i>. |
| 559 */ |
| 560 static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTim
eErrorCode('INVALID_OVERRIDE_POSITIONAL', 46, ""); |
| 561 /** |
| 562 * 7.1 Instance Methods: It is a compile-time error if an instance method <i>m
1</i> overrides an |
| 563 * instance member <i>m2</i> and <i>m1</i> has a different number of required
parameters than |
| 564 * <i>m2</i>. |
| 565 */ |
| 566 static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeE
rrorCode('INVALID_OVERRIDE_REQUIRED', 47, ""); |
| 567 /** |
| 568 * 12.10 This: It is a compile-time error if this appears in a top-level funct
ion or variable |
| 569 * initializer, in a factory constructor, or in a static method or variable in
itializer, or in the |
| 570 * initializer of an instance variable. |
| 571 */ |
| 572 static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeE
rrorCode('INVALID_REFERENCE_TO_THIS', 48, ""); |
| 573 /** |
| 574 * 12.7 Maps: It is a compile-time error if the first type argument to a map l
iteral is not |
| 575 * String. |
| 576 */ |
| 577 static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileT
imeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 49, ""); |
| 578 /** |
| 579 * 12.6 Lists: It is a compile time error if the type argument of a constant l
ist literal includes |
| 580 * a type parameter. |
| 581 */ |
| 582 static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new Co
mpileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 50, ""); |
| 583 /** |
| 584 * 12.7 Maps: It is a compile time error if the type arguments of a constant m
ap literal include a |
| 585 * type parameter. |
| 586 */ |
| 587 static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new Com
pileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 51, ""); |
| 588 /** |
| 589 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile-time |
| 590 * error if <i>k</i>'s initializer list contains an initializer for a variable
that is not an |
| 591 * instance variable declared in the immediately surrounding class. |
| 592 */ |
| 593 static final CompileTimeErrorCode INVALID_VARIABLE_IN_INITIALIZER = new Compil
eTimeErrorCode('INVALID_VARIABLE_IN_INITIALIZER', 52, ""); |
| 594 /** |
| 595 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su
b></i> exists within |
| 596 * the innermost function in which <i>s<sub>b</sub></i> occurs. |
| 597 * <p> |
| 598 * 13.14 Continue: It is a compile-time error if no such statement or case cla
use |
| 599 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub
>c</sub></i> occurs. |
| 600 * @param labelName the name of the unresolvable label |
| 601 */ |
| 602 static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorC
ode('LABEL_IN_OUTER_SCOPE', 53, "Cannot reference label '%s' declared in an oute
r method or function"); |
| 603 /** |
| 604 * 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</su
b></i> exists within |
| 605 * the innermost function in which <i>s<sub>b</sub></i> occurs. |
| 606 * <p> |
| 607 * 13.14 Continue: It is a compile-time error if no such statement or case cla
use |
| 608 * <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub
>c</sub></i> occurs. |
| 609 * @param labelName the name of the unresolvable label |
| 610 */ |
| 611 static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('
LABEL_UNDEFINED', 54, "Cannot reference undefined label '%s'"); |
| 612 /** |
| 613 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member
with the same name |
| 614 * as <i>C</i>. |
| 615 */ |
| 616 static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErro
rCode('MEMBER_WITH_CLASS_NAME', 55, ""); |
| 617 /** |
| 618 * 9 Mixins: It is a compile-time error if a declared or derived mixin explici
tly declares a |
| 619 * constructor. |
| 620 */ |
| 621 static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTime
ErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 56, ""); |
| 622 /** |
| 623 * 9 Mixins: It is a compile-time error if a mixin is derived from a class who
se superclass is not |
| 624 * Object. |
| 625 */ |
| 626 static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new Compile
TimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 57, ""); |
| 627 /** |
| 628 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not deno
te a class or mixin |
| 629 * available in the immediately enclosing scope. |
| 630 */ |
| 631 static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCod
e('MIXIN_OF_NON_CLASS', 58, ""); |
| 632 /** |
| 633 * 9.1 Mixin Application: If <i>M</i> is a class, it is a compile time error i
f a well formed |
| 634 * mixin cannot be derived from <i>M</i>. |
| 635 */ |
| 636 static final CompileTimeErrorCode MIXIN_OF_NON_MIXIN = new CompileTimeErrorCod
e('MIXIN_OF_NON_MIXIN', 59, ""); |
| 637 /** |
| 638 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers
to super. |
| 639 */ |
| 640 static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErro
rCode('MIXIN_REFERENCES_SUPER', 60, ""); |
| 641 /** |
| 642 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not deno
te a class available |
| 643 * in the immediately enclosing scope. |
| 644 */ |
| 645 static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new Compil
eTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 61, ""); |
| 646 /** |
| 647 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Th
en <i>k</i> may |
| 648 * include at most one superinitializer in its initializer list or a compile t
ime error occurs. |
| 649 */ |
| 650 static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTim
eErrorCode('MULTIPLE_SUPER_INITIALIZERS', 62, ""); |
| 651 /** |
| 652 * 12.11.1 New: It is a compile time error if <i>S</i> is not a generic type w
ith <i>m</i> type |
| 653 * parameters. |
| 654 * @param typeName the name of the type being referenced (<i>S</i>) |
| 655 * @param argumentCount the number of type arguments provided |
| 656 * @param parameterCount the number of type parameters that were declared |
| 657 */ |
| 658 static final CompileTimeErrorCode NEW_WITH_INVALID_TYPE_PARAMETERS = new Compi
leTimeErrorCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 63, "The type '%s' is declar
ed with %d type parameters, but %d type arguments were given"); |
| 659 /** |
| 660 * 13.2 Expression Statements: It is a compile-time error if a non-constant ma
p literal that has |
| 661 * no explicit type arguments appears in a place where a statement is expected
. |
| 662 */ |
| 663 static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new
CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 64, ""); |
| 664 /** |
| 665 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub
>11</sub> … |
| 666 * label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> … label<sub>n1
</sub> … |
| 667 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</s
ub>}</i> or the form |
| 668 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case e<sub>
1</sub>: |
| 669 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case
e<sub>n</sub>: |
| 670 * s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>
k</sub></i> are not |
| 671 * compile-time constants, for all <i>1 <= k <= n</i>. |
| 672 */ |
| 673 static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTi
meErrorCode('NON_CONSTANT_CASE_EXPRESSION', 65, ""); |
| 674 /** |
| 675 * 6.2.2 Optional Formals: It is a compile-time error if the default value of
an optional |
| 676 * parameter is not a compile-time constant. |
| 677 */ |
| 678 static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTime
ErrorCode('NON_CONSTANT_DEFAULT_VALUE', 66, ""); |
| 679 /** |
| 680 * 12.6 Lists: It is a compile time error if an element of a constant list lit
eral is not a |
| 681 * compile-time constant. |
| 682 */ |
| 683 static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeE
rrorCode('NON_CONSTANT_LIST_ELEMENT', 67, ""); |
| 684 /** |
| 685 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 686 * literal is not a compile-time constant. |
| 687 */ |
| 688 static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorC
ode('NON_CONSTANT_MAP_KEY', 68, ""); |
| 689 /** |
| 690 * 12.7 Maps: It is a compile time error if either a key or a value of an entr
y in a constant map |
| 691 * literal is not a compile-time constant. |
| 692 */ |
| 693 static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErro
rCode('NON_CONSTANT_MAP_VALUE', 69, ""); |
| 694 /** |
| 695 * 7.6.3 Constant Constructors: Any expression that appears within the initial
izer list of a |
| 696 * constant constructor must be a potentially constant expression, or a compil
e-time error occurs. |
| 697 */ |
| 698 static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new Comp
ileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 70, ""); |
| 699 /** |
| 700 * 7.9 Superclasses: It is a compile-time error to specify an extends clause f
or class Object. |
| 701 */ |
| 702 static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new Com
pileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 71, ""); |
| 703 /** |
| 704 * 7.1.1 Operators: It is a compile-time error to declare an optional paramete
r in an operator. |
| 705 */ |
| 706 static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new Compile
TimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 72, ""); |
| 707 /** |
| 708 * 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> o
verrides an |
| 709 * interface member <i>m2</i> and <i>m1</i> does not declare all the named par
ameters declared by |
| 710 * <i>m2</i> in the same order. |
| 711 */ |
| 712 static final CompileTimeErrorCode OVERRIDE_MISSING_NAMED_PARAMETERS = new Comp
ileTimeErrorCode('OVERRIDE_MISSING_NAMED_PARAMETERS', 73, ""); |
| 713 /** |
| 714 * 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> o
verrides an |
| 715 * interface member <i>m2</i> and <i>m1</i> has a different number of required
parameters than |
| 716 * <i>m2</i>. |
| 717 */ |
| 718 static final CompileTimeErrorCode OVERRIDE_MISSING_REQUIRED_PARAMETERS = new C
ompileTimeErrorCode('OVERRIDE_MISSING_REQUIRED_PARAMETERS', 74, ""); |
| 719 /** |
| 720 * 14.3 Parts: It is a compile time error if the contents of the URI are not a
valid part |
| 721 * declaration. |
| 722 */ |
| 723 static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode(
'PART_OF_NON_PART', 75, ""); |
| 724 /** |
| 725 * 14.1 Imports: It is a compile-time error if the current library declares a
top-level member |
| 726 * named <i>p</i>. |
| 727 */ |
| 728 static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new
CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 76, ""); |
| 729 /** |
| 730 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named o
ptional parameter |
| 731 * begins with an ‘_’ character. |
| 732 */ |
| 733 static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTime
ErrorCode('PRIVATE_OPTIONAL_PARAMETER', 77, ""); |
| 734 /** |
| 735 * 12.1 Constants: It is a compile-time error if the value of a compile-time c
onstant expression |
| 736 * depends on itself. |
| 737 */ |
| 738 static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new Compil
eTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 78, ""); |
| 739 /** |
| 740 * 7.6.2 Factories: It is a compile-time error if a redirecting factory constr
uctor redirects to |
| 741 * itself, either directly or indirectly via a sequence of redirections. |
| 742 */ |
| 743 static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTime
ErrorCode('RECURSIVE_FACTORY_REDIRECT', 79, ""); |
| 744 /** |
| 745 * 15.3.1 Typedef: It is a compile-time error if a typedef refers to itself vi
a a chain of |
| 746 * references that does not include a class type. |
| 747 */ |
| 748 static final CompileTimeErrorCode RECURSIVE_FUNCTION_TYPE_ALIAS = new CompileT
imeErrorCode('RECURSIVE_FUNCTION_TYPE_ALIAS', 80, ""); |
| 749 /** |
| 750 * 8.1 Superinterfaces: It is a compile-time error if an interface is a superi
nterface of itself. |
| 751 */ |
| 752 static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new Compil
eTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 81, ""); |
| 753 /** |
| 754 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with th
e const modifier but |
| 755 * <i>k’</i> is not a constant constructor. |
| 756 */ |
| 757 static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new Comp
ileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 82, ""); |
| 758 /** |
| 759 * 13.3 Local Variable Declaration: It is a compile-time error if <i>e</i> ref
ers to the name |
| 760 * <i>v</i> or the name <i>v=</i>. |
| 761 */ |
| 762 static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZE
R = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 83
, ""); |
| 763 /** |
| 764 * 16.1.1 Reserved Words: A reserved word may not be used as an identifier; it
is a compile-time |
| 765 * error if a reserved word is used where an identifier is expected. |
| 766 */ |
| 767 static final CompileTimeErrorCode RESERVED_WORD_AS_IDENTIFIER = new CompileTim
eErrorCode('RESERVED_WORD_AS_IDENTIFIER', 84, ""); |
| 768 /** |
| 769 * 13.11 Return: It is a compile-time error if a return statement of the form
<i>return e;</i> |
| 770 * appears in a generative constructor. |
| 771 */ |
| 772 static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new Compi
leTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 85, ""); |
| 773 /** |
| 774 * 6.1 Function Declarations: It is a compile-time error to preface a function
declaration with |
| 775 * the built-in identifier static. |
| 776 */ |
| 777 static final CompileTimeErrorCode STATIC_TOP_LEVEL_FUNCTION = new CompileTimeE
rrorCode('STATIC_TOP_LEVEL_FUNCTION', 86, ""); |
| 778 /** |
| 779 * 5 Variables: It is a compile-time error to preface a top level variable dec
laration with the |
| 780 * built-in identifier static. |
| 781 */ |
| 782 static final CompileTimeErrorCode STATIC_TOP_LEVEL_VARIABLE = new CompileTimeE
rrorCode('STATIC_TOP_LEVEL_VARIABLE', 87, ""); |
| 783 /** |
| 784 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 785 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 786 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a compile-time error if a supe
r method invocation |
| 787 * occurs in a top-level function or variable initializer, in an instance vari
able initializer or |
| 788 * initializer list, in class Object, in a factory constructor, or in a static
method or variable |
| 789 * initializer. |
| 790 */ |
| 791 static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeEr
rorCode('SUPER_IN_INVALID_CONTEXT', 88, ""); |
| 792 /** |
| 793 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
is a compile-time |
| 794 * error if a generative constructor of class Object includes a superinitializ
er. |
| 795 */ |
| 796 static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTim
eErrorCode('SUPER_INITIALIZER_IN_OBJECT', 89, ""); |
| 797 /** |
| 798 * 12.8 Throw: It is a compile-time error if an expression of the form throw;
is not enclosed |
| 799 * within a on-catch clause. |
| 800 */ |
| 801 static final CompileTimeErrorCode THROW_WITHOUT_VALUE_OUTSIDE_ON = new Compile
TimeErrorCode('THROW_WITHOUT_VALUE_OUTSIDE_ON', 90, ""); |
| 802 /** |
| 803 * 12.11 Instance Creation: It is a compile-time error if a constructor of a n
on-generic type |
| 804 * invoked by a new expression or a constant object expression is passed any t
ype arguments. |
| 805 * <p> |
| 806 * 12.32 Type Cast: It is a compile-time error if <i>T</i> is a parameterized
type of the form |
| 807 * <i>G<T<sub>1</sub>, …, T<sub>n</sub>></i> and <i>G</i> is not
a generic type with |
| 808 * <i>n</i> type parameters. |
| 809 */ |
| 810 static final CompileTimeErrorCode TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS = new C
ompileTimeErrorCode('TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS', 91, ""); |
| 811 /** |
| 812 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the super
initializer appears |
| 813 * and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generativ
e constructor. It is |
| 814 * a compile-time error if class <i>S</i> does not declare a generative constr
uctor named <i>S</i> |
| 815 * (respectively <i>S.id</i>) |
| 816 */ |
| 817 static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new C
ompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 92, ""); |
| 818 /** |
| 819 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Ea
ch final instance |
| 820 * variable <i>f</i> declared in the immediately enclosing class must have an
initializer in |
| 821 * <i>k</i>'s initializer list unless it has already been initialized by one o
f the following |
| 822 * means: |
| 823 * <ol> |
| 824 * <li>Initialization at the declaration of <i>f</i>. |
| 825 * <li>Initialization by means of an initializing formal of <i>k</i>. |
| 826 * </ol> |
| 827 * or a compile-time error occurs. |
| 828 */ |
| 829 static final CompileTimeErrorCode UNINITIALIZED_FINAL_FIELD = new CompileTimeE
rrorCode('UNINITIALIZED_FINAL_FIELD', 93, ""); |
| 830 /** |
| 831 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time
constant, or if |
| 832 * <i>x</i> involves string interpolation. |
| 833 * <p> |
| 834 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time co
nstant, or if |
| 835 * <i>s</i> involves string interpolation. |
| 836 * <p> |
| 837 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that d
escribes a URI is |
| 838 * not a compile-time constant, or if <i>x</i> involves string interpolation. |
| 839 */ |
| 840 static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErro
rCode('URI_WITH_INTERPOLATION', 94, "URIs cannot use string interpolation"); |
| 841 /** |
| 842 * 7.1.1 Operators: It is a compile-time error if the arity of the user-declar
ed operator []= is |
| 843 * not 2. It is a compile time error if the arity of a user-declared operator
with one of the |
| 844 * names: <, >, <=, >=, ==, +, /, ~/, *, %, |, ^, &, <<, >
;>, [] is not 1. |
| 845 * It is a compile time error if the arity of the user-declared operator - is
not 0 or 1. It is a |
| 846 * compile time error if the arity of the user-declared operator ~ is not 0. |
| 847 */ |
| 848 static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = ne
w CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 95, ""); |
| 849 /** |
| 850 * 7.3 Setters: It is a compile-time error if a setter’s formal parameter li
st does not include |
| 851 * exactly one required formal parameter <i>p</i>. |
| 852 */ |
| 853 static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new
CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 96, ""); |
| 854 /** |
| 855 * 12.11 Instance Creation: It is a compile-time error if a constructor of a g
eneric type with |
| 856 * <i>n</i> type parameters invoked by a new expression or a constant object e
xpression is passed |
| 857 * <i>m</i> type arguments where <i>m != n</i>. |
| 858 * <p> |
| 859 * 12.31 Type Test: It is a compile-time error if <i>T</i> is a parameterized
type of the form |
| 860 * <i>G<T<sub>1</sub>, …, T<sub>n</sub>></i> and <i>G</i> is not
a generic type with |
| 861 * <i>n</i> type parameters. |
| 862 */ |
| 863 static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new Compile
TimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 97, ""); |
| 864 static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_
IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUI
LT_IN_IDENTIFIER_AS_TYPE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_T
IME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER, CONST_CO
NSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_N
ON_CONSTANT_VALUE, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETE
RS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE,
CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, DEFAULT_VALUE_IN_
FUNCTION_TYPE_ALIAS, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMB
ER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_OF_NON_LIBRARY, EXTEND
S_NON_CLASS, EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIP
LE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIAL
IZED_IN_PARAMETER_AND_INITIALIZER, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_
INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FI
NAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLE
MENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLEMENTS_SELF, IMPORT_DUPLICATED_LIBRARY
_NAME, IMPORT_OF_NON_LIBRARY, INCONSITENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR
_NON_EXISTANT_FIELD, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS,
INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITI
ONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMEN
T_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_M
AP, INVALID_VARIABLE_IN_INITIALIZER, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMB
ER_WITH_CLASS_NAME, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT,
MIXIN_OF_NON_CLASS, MIXIN_OF_NON_MIXIN, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_C
LASS_SUPERCLASS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS,
NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTAN
T_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_M
AP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS,
OPTIONAL_PARAMETER_IN_OPERATOR, OVERRIDE_MISSING_NAMED_PARAMETERS, OVERRIDE_MIS
SING_REQUIRED_PARAMETERS, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBE
R, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_FACTOR
Y_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, REDI
RECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RE
SERVED_WORD_AS_IDENTIFIER, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FU
NCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_INITIALIZER_I
N_OBJECT, THROW_WITHOUT_VALUE_OUTSIDE_ON, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS,
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNINITIALIZED_FINAL_FIELD, URI_WITH_INTERP
OLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR
_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS]; |
| 865 final String __name; |
| 866 final int __ordinal; |
| 867 /** |
| 868 * The message template used to create the message to be displayed for this er
ror. |
| 869 */ |
| 870 String _message; |
| 871 /** |
| 872 * Initialize a newly created error code to have the given message. |
| 873 * @param message the message template used to create the message to be displa
yed for the error |
| 874 */ |
| 875 CompileTimeErrorCode(this.__name, this.__ordinal, String message) { |
| 876 this._message = message; |
| 877 } |
| 878 ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity; |
| 879 String get message => _message; |
| 880 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 881 bool needsRecompilation() => true; |
| 882 String toString() => __name; |
| 883 } |
| 884 /** |
| 885 * The enumeration {@code StaticWarningCode} defines the error codes used for st
atic warnings. The |
| 886 * convention for this class is for the name of the error code to indicate the p
roblem that caused |
| 887 * the error to be generated and for the error message to explain what is wrong
and, when |
| 888 * appropriate, how the problem can be corrected. |
| 889 */ |
| 890 class StaticWarningCode implements ErrorCode { |
| 891 /** |
| 892 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>,
1 <= i <= n+ |
| 893 * k</i> may not be assigned to the type of the corresponding formal parameter
of the constructor |
| 894 * <i>T.id</i> (respectively <i>T</i>). |
| 895 * <p> |
| 896 * 12.11.2 Const: It is a static warning if the static type of <i>a<sub>i</sub
>, 1 <= i <= |
| 897 * n+ k</i> may not be assigned to the type of the corresponding formal parame
ter of the |
| 898 * constructor <i>T.id</i> (respectively <i>T</i>). |
| 899 * <p> |
| 900 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static
type of |
| 901 * <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 <= |
| 902 * 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>. |
| 903 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<
sub>j</sub>, 1 <= |
| 904 * j <= m</i>. |
| 905 * <p> |
| 906 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub>, 1 &
lt;= i <= l</i>, |
| 907 * must have a corresponding named parameter in the set <i>{p<sub>n+1</sub>, &
hellip; |
| 908 * p<sub>n+k</sub>}</i> or a static warning occurs. It is a static warning if |
| 909 * <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>, |
| 910 * 1 <= j <= l</i>. |
| 911 */ |
| 912 static final StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = new StaticWarnin
gCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', 0, ""); |
| 913 /** |
| 914 * 5 Variables: Attempting to assign to a final variable elsewhere will cause
a NoSuchMethodError |
| 915 * to be thrown, because no setter is defined for it. The assignment will also
give rise to a |
| 916 * static warning for the same reason. |
| 917 */ |
| 918 static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode('AS
SIGNMENT_TO_FINAL', 1, ""); |
| 919 /** |
| 920 * 13.9 Switch: It is a static warning if the last statement of the statement
sequence |
| 921 * <i>s<sub>k</sub></i> is not a break, continue, return or throw statement. |
| 922 */ |
| 923 static final StaticWarningCode CASE_BLOCK_NOT_TERMINATED = new StaticWarningCo
de('CASE_BLOCK_NOT_TERMINATED', 2, ""); |
| 924 /** |
| 925 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type
available in the |
| 926 * current lexical scope. |
| 927 */ |
| 928 static final StaticWarningCode CAST_TO_NON_TYPE = new StaticWarningCode('CAST_
TO_NON_TYPE', 3, ""); |
| 929 /** |
| 930 * 16.1.2 Comments: A token of the form <i>[new c](uri)</i> will be replaced b
y a link in the |
| 931 * formatted output. The link will point at the constructor named <i>c</i> in
<i>L</i>. The title |
| 932 * of the link will be <i>c</i>. It is a static warning if uri is not the URI
of a dart library |
| 933 * <i>L</i>, or if <i>c</i> is not the name of a constructor of a class declar
ed in the exported |
| 934 * namespace of <i>L</i>. |
| 935 */ |
| 936 static final StaticWarningCode COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE = new
StaticWarningCode('COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE', 4, ""); |
| 937 /** |
| 938 * 16.1.2 Comments: A token of the form <i>[id](uri)</i> will be replaced by a
link in the |
| 939 * formatted output. The link will point at the declaration named <i>id</i> in
<i>L</i>. The title |
| 940 * of the link will be <i>id</i>. It is a static warning if uri is not the URI
of a dart library |
| 941 * <i>L</i>, or if <i>id</i> is not a name declared in the exported namespace
of <i>L</i>. |
| 942 */ |
| 943 static final StaticWarningCode COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE = new
StaticWarningCode('COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE', 5, ""); |
| 944 /** |
| 945 * 16.1.2 Comments: It is a static warning if <i>c</i> does not denote a const
ructor that |
| 946 * available in the scope of the documentation comment. |
| 947 */ |
| 948 static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR = new
StaticWarningCode('COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR', 6, ""); |
| 949 /** |
| 950 * 16.1.2 Comments: It is a static warning if <i>id</i> does not denote a decl
aration that |
| 951 * available in the scope of the documentation comment. |
| 952 */ |
| 953 static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_IDENTIFIER = new S
taticWarningCode('COMMENT_REFERENCE_UNDECLARED_IDENTIFIER', 7, ""); |
| 954 /** |
| 955 * 16.1.2 Comments: A token of the form <i>[id](uri)</i> will be replaced by a
link in the |
| 956 * formatted output. The link will point at the declaration named <i>id</i> in
<i>L</i>. The title |
| 957 * of the link will be <i>id</i>. It is a static warning if uri is not the URI
of a dart library |
| 958 * <i>L</i>, or if <i>id</i> is not a name declared in the exported namespace
of <i>L</i>. |
| 959 */ |
| 960 static final StaticWarningCode COMMENT_REFERENCE_URI_NOT_LIBRARY = new StaticW
arningCode('COMMENT_REFERENCE_URI_NOT_LIBRARY', 8, ""); |
| 961 /** |
| 962 * 7.4 Abstract Instance Members: It is a static warning if an abstract member
is declared or |
| 963 * inherited in a concrete class. |
| 964 */ |
| 965 static final StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = new Stati
cWarningCode('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', 9, ""); |
| 966 /** |
| 967 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an instanc
e getter named |
| 968 * <i>v</i> and an accessible static member named <i>v</i> or <i>v=</i> is dec
lared in a |
| 969 * superclass of <i>C</i>. |
| 970 */ |
| 971 static final StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMB
ER = new StaticWarningCode('CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER',
10, ""); |
| 972 /** |
| 973 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an instanc
e setter named |
| 974 * <i>v=</i> and an accessible static member named <i>v=</i> or <i>v</i> is de
clared in a |
| 975 * superclass of <i>C</i>. |
| 976 */ |
| 977 static final StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMB
ER = new StaticWarningCode('CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER',
11, ""); |
| 978 /** |
| 979 * 7.2 Getters: It is a static warning if a class declares a static getter nam
ed <i>v</i> and also |
| 980 * has a non-static setter named <i>v=</i>. |
| 981 */ |
| 982 static final StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER =
new StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', 12, ""); |
| 983 /** |
| 984 * 7.3 Setters: It is a static warning if a class declares a static setter nam
ed <i>v=</i> and |
| 985 * also has a non-static member named <i>v</i>. |
| 986 */ |
| 987 static final StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTER =
new StaticWarningCode('CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTER', 13, ""); |
| 988 /** |
| 989 * 12.11.2 Const: Given an instance creation expression of the form <i>const q
(a<sub>1</sub>, |
| 990 * … a<sub>n</sub>)</i> it is a static warning if <i>q</i> is the const
ructor of an |
| 991 * abstract class but <i>q</i> is not a factory constructor. |
| 992 */ |
| 993 static final StaticWarningCode CONST_WITH_ABSTRACT_CLASS = new StaticWarningCo
de('CONST_WITH_ABSTRACT_CLASS', 14, ""); |
| 994 /** |
| 995 * 12.7 Maps: It is a static warning if the values of any two keys in a map li
teral are equal. |
| 996 */ |
| 997 static final StaticWarningCode EQUAL_KEYS_IN_MAP = new StaticWarningCode('EQUA
L_KEYS_IN_MAP', 15, ""); |
| 998 /** |
| 999 * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.
id</i>. It is a |
| 1000 * static warning if the static type of <i>id</i> is not assignable to <i>T<su
b>id</sub></i>. |
| 1001 */ |
| 1002 static final StaticWarningCode FIELD_INITIALIZER_WITH_INVALID_TYPE = new Stati
cWarningCode('FIELD_INITIALIZER_WITH_INVALID_TYPE', 16, ""); |
| 1003 /** |
| 1004 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</
i> or if <i>m > |
| 1005 * n</i>. |
| 1006 */ |
| 1007 static final StaticWarningCode INCORRECT_NUMBER_OF_ARGUMENTS = new StaticWarni
ngCode('INCORRECT_NUMBER_OF_ARGUMENTS', 17, ""); |
| 1008 /** |
| 1009 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares a
n instance method |
| 1010 * named <i>n</i> and an accessible static member named <i>n</i> is declared i
n a superclass of |
| 1011 * <i>C</i>. |
| 1012 */ |
| 1013 static final StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC = new StaticWarningCode('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STA
TIC', 18, ""); |
| 1014 /** |
| 1015 * 7.6.2 Factories: It is a static warning if <i>M.id</i> is not a constructor
name. |
| 1016 */ |
| 1017 static final StaticWarningCode INVALID_FACTORY_NAME = new StaticWarningCode('I
NVALID_FACTORY_NAME', 19, ""); |
| 1018 /** |
| 1019 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a gette
r <i>m2</i> and the |
| 1020 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. |
| 1021 */ |
| 1022 static final StaticWarningCode INVALID_OVERRIDE_GETTER_TYPE = new StaticWarnin
gCode('INVALID_OVERRIDE_GETTER_TYPE', 20, ""); |
| 1023 /** |
| 1024 * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i
> overrides an |
| 1025 * instance method <i>m2</i> and the type of <i>m1</i> is not a subtype of the
type of <i>m2</i>. |
| 1026 */ |
| 1027 static final StaticWarningCode INVALID_OVERRIDE_RETURN_TYPE = new StaticWarnin
gCode('INVALID_OVERRIDE_RETURN_TYPE', 21, ""); |
| 1028 /** |
| 1029 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a sette
r <i>m2</i> and the |
| 1030 * type of <i>m1</i> is not a subtype of the type of <i>m2</i>. |
| 1031 */ |
| 1032 static final StaticWarningCode INVALID_OVERRIDE_SETTER_RETURN_TYPE = new Stati
cWarningCode('INVALID_OVERRIDE_SETTER_RETURN_TYPE', 22, ""); |
| 1033 /** |
| 1034 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 1035 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 1036 * 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 |
| 1037 * <i>F</i> of <i>S.m</i> may not be assigned to a function type. |
| 1038 */ |
| 1039 static final StaticWarningCode INVOCATION_OF_NON_FUNCTION = new StaticWarningC
ode('INVOCATION_OF_NON_FUNCTION', 23, ""); |
| 1040 /** |
| 1041 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i>
with argument type |
| 1042 * <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i
> may not be |
| 1043 * assigned to <i>S</i>. |
| 1044 */ |
| 1045 static final StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = new Static
WarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', 24, ""); |
| 1046 /** |
| 1047 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an abst
ract class and |
| 1048 * <i>q</i> is not a factory constructor. |
| 1049 */ |
| 1050 static final StaticWarningCode NEW_WITH_ABSTRACT_CLASS = new StaticWarningCode
('NEW_WITH_ABSTRACT_CLASS', 25, ""); |
| 1051 /** |
| 1052 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible i
n the current scope, |
| 1053 * optionally followed by type arguments. |
| 1054 */ |
| 1055 static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_
WITH_NON_TYPE', 26, ""); |
| 1056 /** |
| 1057 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
current scope then: |
| 1058 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, a<sub>n<
/sub>, |
| 1059 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub
>)</i> it is a |
| 1060 * static warning if <i>T.id</i> is not the name of a constructor declared by
the type <i>T</i>. |
| 1061 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<
sub>n+1</sub>: |
| 1062 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a sta
tic warning if the |
| 1063 * type <i>T</i> does not declare a constructor with the same name as the decl
aration of <i>T</i>. |
| 1064 */ |
| 1065 static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = new StaticWarn
ingCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', 27, ""); |
| 1066 /** |
| 1067 * 7.10 Superinterfaces: It is a static warning if the implicit interface of a
non-abstract class |
| 1068 * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare
or inherit a |
| 1069 * corresponding instance member <i>m</i>. |
| 1070 */ |
| 1071 static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER = n
ew StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER', 28, ""); |
| 1072 /** |
| 1073 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
class inherits an |
| 1074 * abstract method. |
| 1075 */ |
| 1076 static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD = n
ew StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD', 29, ""); |
| 1077 /** |
| 1078 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
available in the |
| 1079 * current lexical scope. |
| 1080 */ |
| 1081 static final StaticWarningCode NON_TYPE = new StaticWarningCode('NON_TYPE', 30
, ""); |
| 1082 /** |
| 1083 * 13.10 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<s
ub>2</sub>) s</i> or |
| 1084 * <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 |
| 1085 * is a static warning if <i>T</i> does not denote a type available in the lex
ical scope of the |
| 1086 * catch clause. |
| 1087 */ |
| 1088 static final StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = new StaticWarningCod
e('NON_TYPE_IN_CATCH_CLAUSE', 31, ""); |
| 1089 /** |
| 1090 * 7.1.1 Operators: It is a static warning if the return type of the user-decl
ared operator []= is |
| 1091 * explicitly declared and not void. |
| 1092 */ |
| 1093 static final StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = new StaticWarnin
gCode('NON_VOID_RETURN_FOR_OPERATOR', 32, ""); |
| 1094 /** |
| 1095 * 7.3 Setters: It is a static warning if a setter declares a return type othe
r than void. |
| 1096 */ |
| 1097 static final StaticWarningCode NON_VOID_RETURN_FOR_SETTER = new StaticWarningC
ode('NON_VOID_RETURN_FOR_SETTER', 33, ""); |
| 1098 /** |
| 1099 * 8 Interfaces: It is a static warning if an interface member <i>m1</i> overr
ides an interface |
| 1100 * member <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of
<i>m2</i>. |
| 1101 */ |
| 1102 static final StaticWarningCode OVERRIDE_NOT_SUBTYPE = new StaticWarningCode('O
VERRIDE_NOT_SUBTYPE', 34, ""); |
| 1103 /** |
| 1104 * 8 Interfaces: It is a static warning if an interface method <i>m1</i> overr
ides an interface |
| 1105 * method <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default
value for a formal |
| 1106 * parameter <i>p</i> and the signature of <i>m1</i> specifies a different def
ault value for |
| 1107 * <i>p</i>. |
| 1108 */ |
| 1109 static final StaticWarningCode OVERRIDE_WITH_DIFFERENT_DEFAULT = new StaticWar
ningCode('OVERRIDE_WITH_DIFFERENT_DEFAULT', 35, ""); |
| 1110 /** |
| 1111 * 14.3 Parts: It is a static warning if the referenced part declaration <i>p<
/i> names a library |
| 1112 * other than the current library as the library to which <i>p</i> belongs. |
| 1113 * @param expectedLibraryName the name of expected library name |
| 1114 * @param actualLibraryName the non-matching actual library name from the "par
t of" declaration |
| 1115 */ |
| 1116 static final StaticWarningCode PART_OF_DIFFERENT_LIBRARY = new StaticWarningCo
de('PART_OF_DIFFERENT_LIBRARY', 36, "Expected this library to be part of '%s', n
ot '%s'"); |
| 1117 /** |
| 1118 * 7.6.2 Factories: It is a static warning if the function type of <i>k’</i>
is not a subtype of |
| 1119 * the type of <i>k</i>. |
| 1120 */ |
| 1121 static final StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = new StaticWar
ningCode('REDIRECT_TO_INVALID_RETURN_TYPE', 37, ""); |
| 1122 /** |
| 1123 * 7.6.2 Factories: It is a static warning if type does not denote a class acc
essible in the |
| 1124 * current scope; if type does denote such a class <i>C</i> it is a static war
ning if the |
| 1125 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const
ructor of <i>C</i>. |
| 1126 */ |
| 1127 static final StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = new StaticWar
ningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', 38, ""); |
| 1128 /** |
| 1129 * 7.6.2 Factories: It is a static warning if type does not denote a class acc
essible in the |
| 1130 * current scope; if type does denote such a class <i>C</i> it is a static war
ning if the |
| 1131 * referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a const
ructor of <i>C</i>. |
| 1132 */ |
| 1133 static final StaticWarningCode REDIRECT_TO_NON_CLASS = new StaticWarningCode('
REDIRECT_TO_NON_CLASS', 39, ""); |
| 1134 /** |
| 1135 * 13.11 Return: Let <i>f</i> be the function immediately enclosing a return s
tatement of the form |
| 1136 * <i>return;</i> It is a static warning if both of the following conditions h
old: |
| 1137 * <ol> |
| 1138 * <li><i>f</i> is not a generative constructor. |
| 1139 * <li>The return type of <i>f</i> may not be assigned to void. |
| 1140 * </ol> |
| 1141 */ |
| 1142 static final StaticWarningCode RETURN_WITHOUT_VALUE = new StaticWarningCode('R
ETURN_WITHOUT_VALUE', 40, ""); |
| 1143 /** |
| 1144 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be assi
gned to the type of |
| 1145 * <i>e<sub>k</sub></i>. |
| 1146 */ |
| 1147 static final StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = new StaticWa
rningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 41, ""); |
| 1148 /** |
| 1149 * 12.15.3 Static Invocation: A static method invocation <i>i</i> has the form |
| 1150 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</
sub>, … |
| 1151 * 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 |
| 1152 * class in the current scope. |
| 1153 */ |
| 1154 static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFI
NED_CLASS', 42, ""); |
| 1155 /** |
| 1156 * 12.17 Getter Invocation: It is a static warning if there is no class <i>C</
i> in the enclosing |
| 1157 * lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or e
xplicitly, a getter |
| 1158 * named <i>m</i>. |
| 1159 */ |
| 1160 static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEF
INED_GETTER', 43, ""); |
| 1161 /** |
| 1162 * 12.30 Identifier Reference: It is as static warning if an identifier expres
sion of the form |
| 1163 * <i>id</i> occurs inside a top level or static function (be it function, met
hod, getter, or |
| 1164 * setter) or variable initializer and there is no declaration <i>d</i> with n
ame <i>id</i> in the |
| 1165 * lexical scope enclosing the expression. |
| 1166 */ |
| 1167 static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('U
NDEFINED_IDENTIFIER', 44, ""); |
| 1168 /** |
| 1169 * 12.18 Assignment: It is as static warning if an assignment of the form <i>v
= e</i> occurs |
| 1170 * inside a top level or static function (be it function, method, getter, or s
etter) or variable |
| 1171 * initializer and there is no declaration <i>d</i> with name <i>v=</i> in the
lexical scope |
| 1172 * enclosing the assignment. |
| 1173 * <p> |
| 1174 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in t
he enclosing lexical |
| 1175 * scope of the assignment, or if <i>C</i> does not declare, implicitly or exp
licitly, a setter |
| 1176 * <i>v=</i>. |
| 1177 */ |
| 1178 static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEF
INED_SETTER', 45, ""); |
| 1179 /** |
| 1180 * 12.15.3 Static Invocation: It is a static warning if <i>C</i> does not decl
are a static method |
| 1181 * or getter <i>m</i>. |
| 1182 */ |
| 1183 static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticW
arningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 46, ""); |
| 1184 static final List<StaticWarningCode> values = [ARGUMENT_TYPE_NOT_ASSIGNABLE, A
SSIGNMENT_TO_FINAL, CASE_BLOCK_NOT_TERMINATED, CAST_TO_NON_TYPE, COMMENT_REFEREN
CE_CONSTRUCTOR_NOT_VISIBLE, COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE, COMMENT_RE
FERENCE_UNDECLARED_CONSTRUCTOR, COMMENT_REFERENCE_UNDECLARED_IDENTIFIER, COMMENT
_REFERENCE_URI_NOT_LIBRARY, CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, CONFLICTING_INS
TANCE_GETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_M
EMBER, CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, CONFLICTING_STATIC_SETTER_
AND_INSTANCE_GETTER, CONST_WITH_ABSTRACT_CLASS, EQUAL_KEYS_IN_MAP, FIELD_INITIAL
IZER_WITH_INVALID_TYPE, INCORRECT_NUMBER_OF_ARGUMENTS, INSTANCE_METHOD_NAME_COLL
IDES_WITH_SUPERCLASS_STATIC, INVALID_FACTORY_NAME, INVALID_OVERRIDE_GETTER_TYPE,
INVALID_OVERRIDE_RETURN_TYPE, INVALID_OVERRIDE_SETTER_RETURN_TYPE, INVOCATION_O
F_NON_FUNCTION, MISMATCHED_GETTER_AND_SETTER_TYPES, NEW_WITH_ABSTRACT_CLASS, NEW
_WITH_NON_TYPE, NEW_WITH_UNDEFINED_CONSTRUCTOR, NON_ABSTRACT_CLASS_INHERITS_ABST
RACT_MEMBER, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD, NON_TYPE, NON_TYPE_IN_
CATCH_CLAUSE, NON_VOID_RETURN_FOR_OPERATOR, NON_VOID_RETURN_FOR_SETTER, OVERRIDE
_NOT_SUBTYPE, OVERRIDE_WITH_DIFFERENT_DEFAULT, PART_OF_DIFFERENT_LIBRARY, REDIRE
CT_TO_INVALID_RETURN_TYPE, REDIRECT_TO_MISSING_CONSTRUCTOR, REDIRECT_TO_NON_CLAS
S, RETURN_WITHOUT_VALUE, SWITCH_EXPRESSION_NOT_ASSIGNABLE, UNDEFINED_CLASS, UNDE
FINED_GETTER, UNDEFINED_IDENTIFIER, UNDEFINED_SETTER, UNDEFINED_STATIC_METHOD_OR
_GETTER]; |
| 1185 final String __name; |
| 1186 final int __ordinal; |
| 1187 /** |
| 1188 * The message template used to create the message to be displayed for this er
ror. |
| 1189 */ |
| 1190 String _message; |
| 1191 /** |
| 1192 * Initialize a newly created error code to have the given type and message. |
| 1193 * @param message the message template used to create the message to be displa
yed for the error |
| 1194 */ |
| 1195 StaticWarningCode(this.__name, this.__ordinal, String message) { |
| 1196 this._message = message; |
| 1197 } |
| 1198 ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity; |
| 1199 String get message => _message; |
| 1200 ErrorType get type => ErrorType.STATIC_WARNING; |
| 1201 bool needsRecompilation() => true; |
| 1202 String toString() => __name; |
| 1203 } |
| 1204 /** |
| 1205 * The interface {@code AnalysisErrorListener} defines the behavior of objects t
hat listen for{@link AnalysisError analysis errors} being produced by the analys
is engine. |
| 1206 */ |
| 1207 abstract class AnalysisErrorListener { |
| 1208 /** |
| 1209 * This method is invoked when an error has been found by the analysis engine. |
| 1210 * @param error the error that was just found (not {@code null}) |
| 1211 */ |
| 1212 void onError(AnalysisError error); |
| 1213 } |
| 1214 /** |
| 1215 * The enumeration {@code StaticTypeWarningCode} defines the error codes used fo
r static type |
| 1216 * warnings. The convention for this class is for the name of the error code to
indicate the problem |
| 1217 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 1218 * when appropriate, how the problem can be corrected. |
| 1219 */ |
| 1220 class StaticTypeWarningCode implements ErrorCode { |
| 1221 /** |
| 1222 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 1223 * warning if <i>T</i> does not have an accessible instance setter named <i>v=
</i>. |
| 1224 * @see #UNDEFINED_SETTER |
| 1225 */ |
| 1226 static final StaticTypeWarningCode INACCESSIBLE_SETTER = new StaticTypeWarning
Code('INACCESSIBLE_SETTER', 0, ""); |
| 1227 /** |
| 1228 * 8.1.1 Inheritance and Overriding: However, if there are multiple members <i
>m<sub>1</sub>, |
| 1229 * … m<sub>k</sub></i> with the same name <i>n</i> that would be inheri
ted (because |
| 1230 * identically named members existed in several superinterfaces) then at most
one member is |
| 1231 * inherited. If the static types <i>T<sub>1</sub>, …, T<sub>k</sub></i
> of the members |
| 1232 * <i>m<sub>1</sub>, …, m<sub>k</sub></i> are not identical, then there
must be a member |
| 1233 * <i>m<sub>x</sub></i> such that <i>T<sub>x</sub> < T<sub>i</sub>, 1 <=
x <= k</i> for |
| 1234 * all <i>i, 1 <= i < k</i>, or a static type warning occurs. The member
that is inherited |
| 1235 * is <i>m<sub>x</sub></i>, if it exists; otherwise: |
| 1236 * <ol> |
| 1237 * <li>If all of <i>m<sub>1</sub>, … m<sub>k</sub></i> have the same nu
mber <i>r</i> of |
| 1238 * required parameters and the same set of named parameters <i>s</i>, then let
<i>h = max( |
| 1239 * numberOfOptionalPositionals( m<sub>i</sub> ) ), 1 <= i <= k</i>. <i>I
</i> has a method |
| 1240 * named <i>n</i>, with <i>r</i> required parameters of type dynamic, <i>h</i>
optional positional |
| 1241 * parameters of type dynamic, named parameters <i>s</i> of type dynamic and r
eturn type dynamic. |
| 1242 * <li>Otherwise none of the members <i>m<sub>1</sub>, …, m<sub>k</sub>
</i> is inherited. |
| 1243 * </ol> |
| 1244 */ |
| 1245 static final StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = new Stati
cTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE', 1, ""); |
| 1246 /** |
| 1247 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i
> may not be |
| 1248 * assigned to the static type of <i>v</i>. The static type of the expression
<i>v = e</i> is the |
| 1249 * static type of <i>e</i>. |
| 1250 * <p> |
| 1251 * 12.18 Assignment: It is a static type warning if the static type of <i>e</i
> may not be |
| 1252 * assigned to the static type of <i>C.v</i>. The static type of the expressio
n <i>C.v = e</i> is |
| 1253 * the static type of <i>e</i>. |
| 1254 * <p> |
| 1255 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 1256 * warning if the static type of <i>e<sub>2</sub></i> may not be assigned to <
i>T</i>. |
| 1257 * @param lhsTypeName the name of the left hand side type |
| 1258 * @param rhsTypeName the name of the right hand side type |
| 1259 */ |
| 1260 static final StaticTypeWarningCode INVALID_ASSIGNMENT = new StaticTypeWarningC
ode('INVALID_ASSIGNMENT', 2, "The type '%s' can't be assigned a '%s'"); |
| 1261 /** |
| 1262 * 12.14.4 Function Expression Invocation: A function expression invocation <i
>i</i> has the form |
| 1263 * <i>e<sub>f</sub>(a<sub>1</sub>, … a<sub>n</sub>, x<sub>n+1</sub>: a<
sub>n+1</sub>, |
| 1264 * …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i>
is an expression. |
| 1265 * <p> |
| 1266 * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub>
</i> may not be |
| 1267 * assigned to a function type. |
| 1268 * <p> |
| 1269 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the
form |
| 1270 * <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</
sub>, … |
| 1271 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
| 1272 * <p> |
| 1273 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if
<i>T</i> does not |
| 1274 * have an accessible instance member named <i>m</i>. If <i>T.m</i> exists, it
is a static warning |
| 1275 * 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 |
| 1276 * not exist, or if <i>F</i> is not a function type, the static type of <i>i</
i> is dynamic. |
| 1277 * <p> |
| 1278 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i>
of <i>C.m</i> may |
| 1279 * not be assigned to a function type. |
| 1280 * @param nonFunctionIdentifier the name of the identifier that is not a funct
ion type |
| 1281 */ |
| 1282 static final StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = new StaticType
WarningCode('INVOCATION_OF_NON_FUNCTION', 3, "'%s' is not a method or function")
; |
| 1283 /** |
| 1284 * 12.19 Conditional: It is a static type warning if the type of <i>e<sub>1</s
ub></i> may not be |
| 1285 * assigned to bool. |
| 1286 * <p> |
| 1287 * 13.5 If: It is a static type warning if the type of the expression <i>b</i>
may not be assigned |
| 1288 * to bool. |
| 1289 * <p> |
| 1290 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be
assigned to bool. |
| 1291 * <p> |
| 1292 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be assi
gned to bool. |
| 1293 */ |
| 1294 static final StaticTypeWarningCode NON_BOOL_CONDITION = new StaticTypeWarningC
ode('NON_BOOL_CONDITION', 4, "Conditions must have a static type of 'bool'"); |
| 1295 /** |
| 1296 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not b
e assigned to either |
| 1297 * bool or () → bool |
| 1298 */ |
| 1299 static final StaticTypeWarningCode NON_BOOL_EXPRESSION = new StaticTypeWarning
Code('NON_BOOL_EXPRESSION', 5, "Assertions must be on either a 'bool' or '() ->
bool'"); |
| 1300 /** |
| 1301 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>,
1 <= i <= |
| 1302 * n</i> does not denote a type in the enclosing lexical scope. |
| 1303 */ |
| 1304 static final StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = new StaticTypeW
arningCode('NON_TYPE_AS_TYPE_ARGUMENT', 6, ""); |
| 1305 /** |
| 1306 * 7.6.2 Factories: It is a static type warning if any of the type arguments t
o <i>k’</i> are not |
| 1307 * subtypes of the bounds of the corresponding formal type parameters of type. |
| 1308 */ |
| 1309 static final StaticTypeWarningCode REDIRECT_WITH_INVALID_TYPE_PARAMETERS = new
StaticTypeWarningCode('REDIRECT_WITH_INVALID_TYPE_PARAMETERS', 7, ""); |
| 1310 /** |
| 1311 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not b
e assigned to the |
| 1312 * declared return type of the immediately enclosing function. |
| 1313 */ |
| 1314 static final StaticTypeWarningCode RETURN_OF_INVALID_TYPE = new StaticTypeWarn
ingCode('RETURN_OF_INVALID_TYPE', 8, "The return type '%s' is not a '%s', as def
ined by the method"); |
| 1315 /** |
| 1316 * 12.11 Instance Creation: It is a static type warning if any of the type arg
uments to a |
| 1317 * constructor of a generic type <i>G</i> invoked by a new expression or a con
stant object |
| 1318 * expression are not subtypes of the bounds of the corresponding formal type
parameters of |
| 1319 * <i>G</i>. |
| 1320 * @param boundedTypeName the name of the type used in the instance creation t
hat should be |
| 1321 * limited by the bound as specified in the class declaration |
| 1322 * @param boundingTypeName the name of the bounding type |
| 1323 */ |
| 1324 static final StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new Sta
ticTypeWarningCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 9, "'%s' does not extend
'%s'"); |
| 1325 /** |
| 1326 * 10 Generics: It is a static type warning if a type parameter is a supertype
of its upper bound. |
| 1327 * <p> |
| 1328 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member <i>m</
i> of <i>G</i>, then |
| 1329 * the static type of the member <i>m</i> of <i>G<A<sub>1</sub>, … A
<sub>n</sub>></i> |
| 1330 * is <i>[A<sub>1</sub>, …, A<sub>n</sub>/T<sub>1</sub>, …, T<su
b>n</sub>]S</i> |
| 1331 * where <i>T<sub>1</sub>, … T<sub>n</sub></i> are the formal type para
meters of <i>G</i>. |
| 1332 * Let <i>B<sub>i</sub></i> be the bounds of <i>T<sub>i</sub>, 1 <= i <=
n</i>. It is a |
| 1333 * static type warning if <i>A<sub>i</sub></i> is not a subtype of <i>[A<sub>1
</sub>, …, |
| 1334 * A<sub>n</sub>/T<sub>1</sub>, …, T<sub>n</sub>]B<sub>i</sub>, 1 <=
i <= n</i>. |
| 1335 */ |
| 1336 static final StaticTypeWarningCode TYPE_ARGUMENT_VIOLATES_BOUNDS = new StaticT
ypeWarningCode('TYPE_ARGUMENT_VIOLATES_BOUNDS', 10, ""); |
| 1337 /** |
| 1338 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
a static type |
| 1339 * warning if <i>T</i> does not have a getter named <i>m</i>. |
| 1340 */ |
| 1341 static final StaticTypeWarningCode UNDEFINED_GETTER = new StaticTypeWarningCod
e('UNDEFINED_GETTER', 11, "There is no such getter '%s' in '%s'"); |
| 1342 /** |
| 1343 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
It is a static type |
| 1344 * warning if <i>T</i> does not have an accessible instance setter named <i>v=
</i>. |
| 1345 * @see #INACCESSIBLE_SETTER |
| 1346 */ |
| 1347 static final StaticTypeWarningCode UNDEFINED_SETTER = new StaticTypeWarningCod
e('UNDEFINED_SETTER', 12, "There is no such setter '%s' in '%s'"); |
| 1348 /** |
| 1349 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 1350 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n
+1</sub>, … |
| 1351 * 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 |
| 1352 * accessible instance member named <i>m</i>. |
| 1353 * @param methodName the name of the method that is undefined |
| 1354 * @param typeName the resolved type name that the method lookup is happening
on |
| 1355 */ |
| 1356 static final StaticTypeWarningCode UNDEFINED_SUPER_METHOD = new StaticTypeWarn
ingCode('UNDEFINED_SUPER_METHOD', 13, "There is no such method '%s' in '%s'"); |
| 1357 /** |
| 1358 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not an
accessible generic |
| 1359 * type declaration with <i>n</i> type parameters. |
| 1360 * @param typeName the name of the type being referenced (<i>G</i>) |
| 1361 * @param argumentCount the number of type arguments provided |
| 1362 * @param parameterCount the number of type parameters that were declared |
| 1363 */ |
| 1364 static final StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new Static
TypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 14, "The type '%s' is declared
with %d type parameters, but %d type arguments were given"); |
| 1365 static final List<StaticTypeWarningCode> values = [INACCESSIBLE_SETTER, INCONS
ISTENT_METHOD_INHERITANCE, INVALID_ASSIGNMENT, INVOCATION_OF_NON_FUNCTION, NON_B
OOL_CONDITION, NON_BOOL_EXPRESSION, NON_TYPE_AS_TYPE_ARGUMENT, REDIRECT_WITH_INV
ALID_TYPE_PARAMETERS, RETURN_OF_INVALID_TYPE, TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
TYPE_ARGUMENT_VIOLATES_BOUNDS, UNDEFINED_GETTER, UNDEFINED_SETTER, UNDEFINED_SU
PER_METHOD, WRONG_NUMBER_OF_TYPE_ARGUMENTS]; |
| 1366 final String __name; |
| 1367 final int __ordinal; |
| 1368 /** |
| 1369 * The message template used to create the message to be displayed for this er
ror. |
| 1370 */ |
| 1371 String _message; |
| 1372 /** |
| 1373 * Initialize a newly created error code to have the given type and message. |
| 1374 * @param message the message template used to create the message to be displa
yed for the error |
| 1375 */ |
| 1376 StaticTypeWarningCode(this.__name, this.__ordinal, String message) { |
| 1377 this._message = message; |
| 1378 } |
| 1379 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
| 1380 String get message => _message; |
| 1381 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; |
| 1382 bool needsRecompilation() => true; |
| 1383 String toString() => __name; |
| 1384 } |
| OLD | NEW |