mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:12:08 +00:00
Update nomenclature in ErrorCode and related classes.
This change standardizes most of the analyzer to refer to problem messages and correction messages using the names `problemMessage` and `correctionMessage` (consistent with the naming convention used in the analyzer and CFE `messages.yaml` files). Change-Id: I72f078a368c65b346626f560cc721fcff4836452 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215151 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
04e184d791
commit
757d179380
|
@ -19,9 +19,9 @@ abstract class ErrorCode {
|
|||
*/
|
||||
final String uniqueName;
|
||||
|
||||
final String _message;
|
||||
final String _problemMessage;
|
||||
|
||||
final String? _correction;
|
||||
final String? _correctionMessage;
|
||||
|
||||
/**
|
||||
* Return `true` if diagnostics with this code have documentation for them
|
||||
|
@ -36,30 +36,34 @@ abstract class ErrorCode {
|
|||
|
||||
/**
|
||||
* Initialize a newly created error code to have the given [name]. The message
|
||||
* associated with the error will be created from the given [message]
|
||||
* associated with the error will be created from the given [problemMessage]
|
||||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
* given [correctionMessage] template.
|
||||
*/
|
||||
const ErrorCode({
|
||||
String? correction,
|
||||
String? correctionMessage,
|
||||
this.hasPublishedDocs = false,
|
||||
this.isUnresolvedIdentifier: false,
|
||||
required String message,
|
||||
required this.name,
|
||||
@Deprecated('Please use problemMessage') String? message,
|
||||
String? problemMessage,
|
||||
required this.uniqueName,
|
||||
}) : _correction = correction,
|
||||
_message = message,
|
||||
}) : _correctionMessage = correctionMessage,
|
||||
_problemMessage = problemMessage ?? message ?? 'NO MESSAGE',
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasPublishedDocs != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isUnresolvedIdentifier != null);
|
||||
assert(isUnresolvedIdentifier != null),
|
||||
assert((message == null) != (problemMessage == null),
|
||||
'Either problemMessage or message must be provided (not both)');
|
||||
|
||||
/**
|
||||
* The template used to create the correction to be displayed for this error,
|
||||
* or `null` if there is no correction information for this error. The
|
||||
* correction should indicate how the user can fix the error.
|
||||
*/
|
||||
String? get correction => customizedCorrections[uniqueName] ?? _correction;
|
||||
String? get correctionMessage =>
|
||||
customizedCorrections[uniqueName] ?? _correctionMessage;
|
||||
|
||||
/**
|
||||
* The severity of the error.
|
||||
|
@ -71,10 +75,12 @@ abstract class ErrorCode {
|
|||
bool get isIgnorable => errorSeverity != ErrorSeverity.ERROR;
|
||||
|
||||
/**
|
||||
* The template used to create the message to be displayed for this error. The
|
||||
* message should indicate what is wrong and why it is wrong.
|
||||
* The template used to create the problem message to be displayed for this
|
||||
* error. The problem message should indicate what is wrong and why it is
|
||||
* wrong.
|
||||
*/
|
||||
String get message => customizedMessages[uniqueName] ?? _message;
|
||||
String get problemMessage =>
|
||||
customizedMessages[uniqueName] ?? _problemMessage;
|
||||
|
||||
/**
|
||||
* The type of the error.
|
||||
|
|
|
@ -155,7 +155,7 @@ class ScannerErrorCode extends ErrorCode {
|
|||
'UNEXPECTED_DOLLAR_IN_STRING',
|
||||
"A '\$' has special meaning inside a string, and must be followed by "
|
||||
"an identifier or an expression in curly braces ({}).",
|
||||
correction: "Try adding a backslash (\\) to escape the '\$'.");
|
||||
correctionMessage: "Try adding a backslash (\\) to escape the '\$'.");
|
||||
|
||||
/**
|
||||
* Parameters:
|
||||
|
@ -167,7 +167,7 @@ class ScannerErrorCode extends ErrorCode {
|
|||
static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT =
|
||||
const ScannerErrorCode(
|
||||
'UNTERMINATED_MULTI_LINE_COMMENT', "Unterminated multi-line comment.",
|
||||
correction: "Try terminating the comment with '*/', or "
|
||||
correctionMessage: "Try terminating the comment with '*/', or "
|
||||
"removing any unbalanced occurrences of '/*'"
|
||||
" (because comments nest in Dart).");
|
||||
|
||||
|
@ -177,14 +177,15 @@ class ScannerErrorCode extends ErrorCode {
|
|||
|
||||
/**
|
||||
* Initialize a newly created error code to have the given [name]. The message
|
||||
* associated with the error will be created from the given [message]
|
||||
* associated with the error will be created from the given [problemMessage]
|
||||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
* given [correctionMessage] template.
|
||||
*/
|
||||
const ScannerErrorCode(String name, String message, {String? correction})
|
||||
const ScannerErrorCode(String name, String problemMessage,
|
||||
{String? correctionMessage})
|
||||
: super(
|
||||
correction: correction,
|
||||
message: message,
|
||||
correctionMessage: correctionMessage,
|
||||
problemMessage: problemMessage,
|
||||
name: name,
|
||||
uniqueName: 'ScannerErrorCode.$name',
|
||||
);
|
||||
|
|
|
@ -157,14 +157,14 @@ class TransformSetErrorCode extends ErrorCode {
|
|||
/// Initialize a newly created error code.
|
||||
const TransformSetErrorCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'TransformSetErrorCode.$name',
|
||||
);
|
||||
|
||||
|
|
|
@ -166,7 +166,8 @@ class AnalysisErrorTest {
|
|||
void test_fromEngine_lint() {
|
||||
engineError = MockAnalysisError(
|
||||
source: source,
|
||||
errorCode: LintCode('my_lint', 'my message', correction: 'correction'),
|
||||
errorCode:
|
||||
LintCode('my_lint', 'my message', correctionMessage: 'correction'),
|
||||
offset: 10,
|
||||
length: 20,
|
||||
message: 'my message',
|
||||
|
@ -390,8 +391,8 @@ class MockErrorCode implements engine.ErrorCode {
|
|||
this.url});
|
||||
|
||||
@override
|
||||
String get correction {
|
||||
throw StateError('Unexpected invocation of correction');
|
||||
String get correctionMessage {
|
||||
throw StateError('Unexpected invocation of correctionMessage');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -404,8 +405,8 @@ class MockErrorCode implements engine.ErrorCode {
|
|||
bool get isUnresolvedIdentifier => false;
|
||||
|
||||
@override
|
||||
String get message {
|
||||
throw StateError('Unexpected invocation of message');
|
||||
String get problemMessage {
|
||||
throw StateError('Unexpected invocation of problemMessage');
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -968,7 +968,7 @@ class AnalysisError implements Diagnostic {
|
|||
|
||||
/// The correction to be displayed for this error, or `null` if there is no
|
||||
/// correction information for this error.
|
||||
String? _correction;
|
||||
String? _correctionMessage;
|
||||
|
||||
/// The source in which the error occurred, or `null` if unknown.
|
||||
final Source source;
|
||||
|
@ -982,22 +982,22 @@ class AnalysisError implements Diagnostic {
|
|||
[List<Object?>? arguments,
|
||||
List<DiagnosticMessage> contextMessages = const []])
|
||||
: _contextMessages = contextMessages {
|
||||
String message = formatList(errorCode.message, arguments);
|
||||
String? correctionTemplate = errorCode.correction;
|
||||
String problemMessage = formatList(errorCode.problemMessage, arguments);
|
||||
String? correctionTemplate = errorCode.correctionMessage;
|
||||
if (correctionTemplate != null) {
|
||||
_correction = formatList(correctionTemplate, arguments);
|
||||
_correctionMessage = formatList(correctionTemplate, arguments);
|
||||
}
|
||||
_problemMessage = DiagnosticMessageImpl(
|
||||
filePath: source.fullName,
|
||||
length: length,
|
||||
message: message,
|
||||
message: problemMessage,
|
||||
offset: offset,
|
||||
url: null);
|
||||
}
|
||||
|
||||
/// Initialize a newly created analysis error with given values.
|
||||
AnalysisError.forValues(this.source, int offset, int length, this.errorCode,
|
||||
String message, this._correction,
|
||||
String message, this._correctionMessage,
|
||||
{List<DiagnosticMessage> contextMessages = const []})
|
||||
: _contextMessages = contextMessages {
|
||||
_problemMessage = DiagnosticMessageImpl(
|
||||
|
@ -1029,10 +1029,10 @@ class AnalysisError implements Diagnostic {
|
|||
/// Return the template used to create the correction to be displayed for this
|
||||
/// error, or `null` if there is no correction information for this error. The
|
||||
/// correction should indicate how the user can fix the error.
|
||||
String? get correction => _correction;
|
||||
String? get correction => _correctionMessage;
|
||||
|
||||
@override
|
||||
String? get correctionMessage => _correction;
|
||||
String? get correctionMessage => _correctionMessage;
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
|
|
|
@ -44,17 +44,17 @@ class AnalysisOptionsErrorCode extends ErrorCode {
|
|||
/// Initialize a newly created error code to have the given [name].
|
||||
const AnalysisOptionsErrorCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'AnalysisOptionsErrorCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
@ -74,7 +74,7 @@ class AnalysisOptionsHintCode extends ErrorCode {
|
|||
AnalysisOptionsHintCode(
|
||||
'PREVIEW_DART_2_SETTING_DEPRECATED',
|
||||
"The 'enablePreviewDart2' setting is deprecated.",
|
||||
correction: "It is no longer necessary to explicitly enable Dart 2.",
|
||||
correctionMessage: "It is no longer necessary to explicitly enable Dart 2.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,8 @@ class AnalysisOptionsHintCode extends ErrorCode {
|
|||
AnalysisOptionsHintCode(
|
||||
'STRONG_MODE_SETTING_DEPRECATED',
|
||||
"The 'strong-mode: true' setting is deprecated.",
|
||||
correction: "It is no longer necessary to explicitly enable strong mode.",
|
||||
correctionMessage:
|
||||
"It is no longer necessary to explicitly enable strong mode.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -95,24 +96,24 @@ class AnalysisOptionsHintCode extends ErrorCode {
|
|||
AnalysisOptionsHintCode(
|
||||
'SUPER_MIXINS_SETTING_DEPRECATED',
|
||||
"The 'enableSuperMixins' setting is deprecated.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Support has been added to the language for 'mixin' based mixins.",
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const AnalysisOptionsHintCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'AnalysisOptionsHintCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
@ -191,7 +192,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
|
|||
AnalysisOptionsWarningCode(
|
||||
'SPEC_MODE_REMOVED',
|
||||
"The option 'strong-mode: false' is no longer supported.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"It's recommended to remove the 'strong-mode:' setting (and make your code Dart 2 compliant).",
|
||||
);
|
||||
|
||||
|
@ -250,7 +251,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
|
|||
AnalysisOptionsWarningCode(
|
||||
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
|
||||
"The option '{1}' isn't supported by '{0}'.",
|
||||
correction: "Try using one of the supported options: {2}.",
|
||||
correctionMessage: "Try using one of the supported options: {2}.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -266,23 +267,23 @@ class AnalysisOptionsWarningCode extends ErrorCode {
|
|||
AnalysisOptionsWarningCode(
|
||||
'UNSUPPORTED_VALUE',
|
||||
"The value '{1}' isn't supported by '{0}'.",
|
||||
correction: "Try using one of the supported options: {2}.",
|
||||
correctionMessage: "Try using one of the supported options: {2}.",
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const AnalysisOptionsWarningCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'AnalysisOptionsWarningCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode ANNOTATION_ON_POINTER_FIELD = FfiCode(
|
||||
'ANNOTATION_ON_POINTER_FIELD',
|
||||
"Fields in a struct class whose type is 'Pointer' should not have any annotations.",
|
||||
correction: "Try removing the annotation.",
|
||||
correctionMessage: "Try removing the annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode ARGUMENT_MUST_BE_A_CONSTANT = FfiCode(
|
||||
'ARGUMENT_MUST_BE_A_CONSTANT',
|
||||
"Argument '{0}' must be a constant.",
|
||||
correction: "Try replacing the value with a literal or const.",
|
||||
correctionMessage: "Try replacing the value with a literal or const.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,8 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode CREATION_OF_STRUCT_OR_UNION = FfiCode(
|
||||
'CREATION_OF_STRUCT_OR_UNION',
|
||||
"Subclasses of 'Struct' and 'Union' are backed by native memory, and can't be instantiated by a generative constructor.",
|
||||
correction: "Try allocating it via allocation, or load from a 'Pointer'.",
|
||||
correctionMessage:
|
||||
"Try allocating it via allocation, or load from a 'Pointer'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode EMPTY_STRUCT = FfiCode(
|
||||
'EMPTY_STRUCT',
|
||||
"Struct '{0}' is empty. Empty structs are undefined behavior.",
|
||||
correction: "Try adding a field to '{0}' or use a different Struct.",
|
||||
correctionMessage: "Try adding a field to '{0}' or use a different Struct.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -59,7 +60,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode EXTRA_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
|
||||
'EXTRA_ANNOTATION_ON_STRUCT_FIELD',
|
||||
"Fields in a struct class must have exactly one annotation indicating the native type.",
|
||||
correction: "Try removing the extra annotation.",
|
||||
correctionMessage: "Try removing the extra annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -68,7 +69,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode EXTRA_SIZE_ANNOTATION_CARRAY = FfiCode(
|
||||
'EXTRA_SIZE_ANNOTATION_CARRAY',
|
||||
"'Array's must have exactly one 'Array' annotation.",
|
||||
correction: "Try removing the extra annotation.",
|
||||
correctionMessage: "Try removing the extra annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -77,7 +78,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode FFI_NATIVE_ONLY_STATIC = FfiCode(
|
||||
'FFI_NATIVE_ONLY_STATIC',
|
||||
"FfiNative annotations can only be used on static functions.",
|
||||
correction: "Change the method to static.",
|
||||
correctionMessage: "Change the method to static.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -86,7 +87,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode FIELD_INITIALIZER_IN_STRUCT = FfiCode(
|
||||
'FIELD_INITIALIZER_IN_STRUCT',
|
||||
"Constructors in subclasses of 'Struct' and 'Union' can't have field initializers.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the field initializer and marking the field as external.",
|
||||
);
|
||||
|
||||
|
@ -96,7 +97,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode FIELD_IN_STRUCT_WITH_INITIALIZER = FfiCode(
|
||||
'FIELD_IN_STRUCT_WITH_INITIALIZER',
|
||||
"Fields in subclasses of 'Struct' and 'Union' can't have initializers.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the initializer and marking the field as external.",
|
||||
);
|
||||
|
||||
|
@ -106,7 +107,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode FIELD_MUST_BE_EXTERNAL_IN_STRUCT = FfiCode(
|
||||
'FIELD_MUST_BE_EXTERNAL_IN_STRUCT',
|
||||
"Fields of 'Struct' and 'Union' subclasses must be marked external.",
|
||||
correction: "Try adding the 'external' modifier.",
|
||||
correctionMessage: "Try adding the 'external' modifier.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -116,7 +117,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode GENERIC_STRUCT_SUBCLASS = FfiCode(
|
||||
'GENERIC_STRUCT_SUBCLASS',
|
||||
"The class '{0}' can't extend 'Struct' or 'Union' because it is generic.",
|
||||
correction: "Try removing the type parameters from '{0}'.",
|
||||
correctionMessage: "Try removing the type parameters from '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -125,7 +126,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode INVALID_EXCEPTION_VALUE = FfiCode(
|
||||
'INVALID_EXCEPTION_VALUE',
|
||||
"The method 'Pointer.fromFunction' must not have an exceptional return value (the second argument) when the return type of the function is either 'void', 'Handle' or 'Pointer'.",
|
||||
correction: "Try removing the exceptional return value.",
|
||||
correctionMessage: "Try removing the exceptional return value.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -135,7 +136,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode INVALID_FIELD_TYPE_IN_STRUCT = FfiCode(
|
||||
'INVALID_FIELD_TYPE_IN_STRUCT',
|
||||
"Fields in struct classes can't have the type '{0}'. They can only be declared as 'int', 'double', 'Array', 'Pointer', or subtype of 'Struct' or 'Union'.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try using 'int', 'double', 'Array', 'Pointer', or subtype of 'Struct' or 'Union'.",
|
||||
);
|
||||
|
||||
|
@ -145,7 +146,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode LEAF_CALL_MUST_NOT_RETURN_HANDLE = FfiCode(
|
||||
'LEAF_CALL_MUST_NOT_RETURN_HANDLE',
|
||||
"FFI leaf call must not return a Handle.",
|
||||
correction: "Try changing the return type to primitive or struct.",
|
||||
correctionMessage: "Try changing the return type to primitive or struct.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -154,7 +155,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode LEAF_CALL_MUST_NOT_TAKE_HANDLE = FfiCode(
|
||||
'LEAF_CALL_MUST_NOT_TAKE_HANDLE',
|
||||
"FFI leaf call must not take arguments of type Handle.",
|
||||
correction: "Try changing the argument type to primitive or struct.",
|
||||
correctionMessage: "Try changing the argument type to primitive or struct.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -163,7 +164,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MISMATCHED_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
|
||||
'MISMATCHED_ANNOTATION_ON_STRUCT_FIELD',
|
||||
"The annotation does not match the declared type of the field.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try using a different annotation or changing the declared type to match.",
|
||||
);
|
||||
|
||||
|
@ -173,7 +174,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MISSING_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
|
||||
'MISSING_ANNOTATION_ON_STRUCT_FIELD',
|
||||
"Fields in a struct class must either have the type 'Pointer' or an annotation indicating the native type.",
|
||||
correction: "Try adding an annotation.",
|
||||
correctionMessage: "Try adding an annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -182,7 +183,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MISSING_EXCEPTION_VALUE = FfiCode(
|
||||
'MISSING_EXCEPTION_VALUE',
|
||||
"The method 'Pointer.fromFunction' must have an exceptional return value (the second argument) when the return type of the function is neither 'void', 'Handle' or 'Pointer'.",
|
||||
correction: "Try adding an exceptional return value.",
|
||||
correctionMessage: "Try adding an exceptional return value.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -192,7 +193,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MISSING_FIELD_TYPE_IN_STRUCT = FfiCode(
|
||||
'MISSING_FIELD_TYPE_IN_STRUCT',
|
||||
"Fields in struct classes must have an explicitly declared type of 'int', 'double' or 'Pointer'.",
|
||||
correction: "Try using 'int', 'double' or 'Pointer'.",
|
||||
correctionMessage: "Try using 'int', 'double' or 'Pointer'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -201,7 +202,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MISSING_SIZE_ANNOTATION_CARRAY = FfiCode(
|
||||
'MISSING_SIZE_ANNOTATION_CARRAY',
|
||||
"'Array's must have exactly one 'Array' annotation.",
|
||||
correction: "Try adding a 'Array' annotation.",
|
||||
correctionMessage: "Try adding a 'Array' annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -212,7 +213,8 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MUST_BE_A_NATIVE_FUNCTION_TYPE = FfiCode(
|
||||
'MUST_BE_A_NATIVE_FUNCTION_TYPE',
|
||||
"The type '{0}' given to '{1}' must be a valid 'dart:ffi' native function type.",
|
||||
correction: "Try changing the type to only use members for 'dart:ffi'.",
|
||||
correctionMessage:
|
||||
"Try changing the type to only use members for 'dart:ffi'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -224,7 +226,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode MUST_BE_A_SUBTYPE = FfiCode(
|
||||
'MUST_BE_A_SUBTYPE',
|
||||
"The type '{0}' must be a subtype of '{1}' for '{2}'.",
|
||||
correction: "Try changing one or both of the type arguments.",
|
||||
correctionMessage: "Try changing one or both of the type arguments.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -234,7 +236,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode NON_CONSTANT_TYPE_ARGUMENT = FfiCode(
|
||||
'NON_CONSTANT_TYPE_ARGUMENT',
|
||||
"The type arguments to '{0}' must be compile time constants but type parameters are not constants.",
|
||||
correction: "Try changing the type argument to be a constant type.",
|
||||
correctionMessage: "Try changing the type argument to be a constant type.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -244,7 +246,8 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER = FfiCode(
|
||||
'NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER',
|
||||
"The type argument for the pointer '{0}' must be a 'NativeFunction' in order to use 'asFunction'.",
|
||||
correction: "Try changing the type argument to be a 'NativeFunction'.",
|
||||
correctionMessage:
|
||||
"Try changing the type argument to be a 'NativeFunction'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -253,7 +256,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode NON_POSITIVE_ARRAY_DIMENSION = FfiCode(
|
||||
'NON_POSITIVE_ARRAY_DIMENSION',
|
||||
"Array dimensions must be positive numbers.",
|
||||
correction: "Try changing the input to a positive number.",
|
||||
correctionMessage: "Try changing the input to a positive number.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -263,7 +266,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode NON_SIZED_TYPE_ARGUMENT = FfiCode(
|
||||
'NON_SIZED_TYPE_ARGUMENT',
|
||||
"Type arguments to '{0}' can't have the type '{1}'. They can only be declared as native integer, 'Float', 'Double', 'Pointer', or subtype of 'Struct' or 'Union'.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try using a native integer, 'Float', 'Double', 'Pointer', or subtype of 'Struct' or 'Union'.",
|
||||
);
|
||||
|
||||
|
@ -273,7 +276,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode PACKED_ANNOTATION = FfiCode(
|
||||
'PACKED_ANNOTATION',
|
||||
"Structs must have at most one 'Packed' annotation.",
|
||||
correction: "Try removing extra 'Packed' annotations.",
|
||||
correctionMessage: "Try removing extra 'Packed' annotations.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -282,7 +285,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode PACKED_ANNOTATION_ALIGNMENT = FfiCode(
|
||||
'PACKED_ANNOTATION_ALIGNMENT',
|
||||
"Only packing to 1, 2, 4, 8, and 16 bytes is supported.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try changing the 'Packed' annotation alignment to 1, 2, 4, 8, or 16.",
|
||||
);
|
||||
|
||||
|
@ -294,7 +297,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode PACKED_NESTING_NON_PACKED = FfiCode(
|
||||
'PACKED_NESTING_NON_PACKED',
|
||||
"Nesting the non-packed or less tightly packed struct '{0}' in a packed struct '{1}' is not supported.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try packing the nested struct or packing the nested struct more tightly.",
|
||||
);
|
||||
|
||||
|
@ -304,7 +307,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SIZE_ANNOTATION_DIMENSIONS = FfiCode(
|
||||
'SIZE_ANNOTATION_DIMENSIONS',
|
||||
"'Array's must have an 'Array' annotation that matches the dimensions.",
|
||||
correction: "Try adjusting the arguments in the 'Array' annotation.",
|
||||
correctionMessage: "Try adjusting the arguments in the 'Array' annotation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -315,7 +318,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_EXTENDS = FfiCode(
|
||||
'SUBTYPE_OF_FFI_CLASS',
|
||||
"The class '{0}' can't extend '{1}'.",
|
||||
correction: "Try extending 'Struct' or 'Union'.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union'.",
|
||||
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_EXTENDS',
|
||||
);
|
||||
|
||||
|
@ -327,7 +330,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS = FfiCode(
|
||||
'SUBTYPE_OF_FFI_CLASS',
|
||||
"The class '{0}' can't implement '{1}'.",
|
||||
correction: "Try extending 'Struct' or 'Union'.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union'.",
|
||||
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS',
|
||||
);
|
||||
|
||||
|
@ -339,7 +342,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_FFI_CLASS_IN_WITH = FfiCode(
|
||||
'SUBTYPE_OF_FFI_CLASS',
|
||||
"The class '{0}' can't mix in '{1}'.",
|
||||
correction: "Try extending 'Struct' or 'Union'.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union'.",
|
||||
uniqueName: 'SUBTYPE_OF_FFI_CLASS_IN_WITH',
|
||||
);
|
||||
|
||||
|
@ -351,7 +354,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS = FfiCode(
|
||||
'SUBTYPE_OF_STRUCT_CLASS',
|
||||
"The class '{0}' can't extend '{1}' because '{1}' is a subtype of 'Struct' or 'Union'.",
|
||||
correction: "Try extending 'Struct' or 'Union' directly.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union' directly.",
|
||||
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS',
|
||||
);
|
||||
|
||||
|
@ -363,7 +366,7 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS = FfiCode(
|
||||
'SUBTYPE_OF_STRUCT_CLASS',
|
||||
"The class '{0}' can't implement '{1}' because '{1}' is a subtype of 'Struct' or 'Union'.",
|
||||
correction: "Try extending 'Struct' or 'Union' directly.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union' directly.",
|
||||
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS',
|
||||
);
|
||||
|
||||
|
@ -375,24 +378,24 @@ class FfiCode extends AnalyzerErrorCode {
|
|||
static const FfiCode SUBTYPE_OF_STRUCT_CLASS_IN_WITH = FfiCode(
|
||||
'SUBTYPE_OF_STRUCT_CLASS',
|
||||
"The class '{0}' can't mix in '{1}' because '{1}' is a subtype of 'Struct' or 'Union'.",
|
||||
correction: "Try extending 'Struct' or 'Union' directly.",
|
||||
correctionMessage: "Try extending 'Struct' or 'Union' directly.",
|
||||
uniqueName: 'SUBTYPE_OF_STRUCT_CLASS_IN_WITH',
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const FfiCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'FfiCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode ASSIGNMENT_OF_DO_NOT_STORE = HintCode(
|
||||
'ASSIGNMENT_OF_DO_NOT_STORE',
|
||||
"'{0}' is marked 'doNotStore' and shouldn't be assigned to a field or top-level variable.",
|
||||
correction: "Try removing the assignment.",
|
||||
correctionMessage: "Try removing the assignment.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = HintCode(
|
||||
'CAN_BE_NULL_AFTER_NULL_AWARE',
|
||||
"The receiver uses '?.', so its value can be null.",
|
||||
correction: "Replace the '.' with a '?.' in the invocation.",
|
||||
correctionMessage: "Replace the '.' with a '?.' in the invocation.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEAD_CODE = HintCode(
|
||||
'DEAD_CODE',
|
||||
"Dead code.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the code, or fixing the code before it so that it can be reached.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -212,7 +212,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = HintCode(
|
||||
'DEAD_CODE_CATCH_FOLLOWING_CATCH',
|
||||
"Dead code: Catch clauses after a 'catch (e)' or an 'on Object catch (e)' are never reached.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try reordering the catch clauses so that they can be reached, or removing the unreachable catch clauses.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -274,7 +274,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = HintCode(
|
||||
'DEAD_CODE_ON_CATCH_SUBTYPE',
|
||||
"Dead code: This on-catch block won’t be executed because '{0}' is a subtype of '{1}' and hence will have been caught already.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try reordering the catch clauses so that this block can be reached, or removing the unreachable catch clause.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -309,7 +309,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_EXTENDS_FUNCTION = HintCode(
|
||||
'DEPRECATED_SUBTYPE_OF_FUNCTION',
|
||||
"Extending 'Function' is deprecated.",
|
||||
correction: "Try removing 'Function' from the 'extends' clause.",
|
||||
correctionMessage: "Try removing 'Function' from the 'extends' clause.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'DEPRECATED_EXTENDS_FUNCTION',
|
||||
);
|
||||
|
@ -320,7 +320,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_FUNCTION_CLASS_DECLARATION = HintCode(
|
||||
'DEPRECATED_FUNCTION_CLASS_DECLARATION',
|
||||
"Declaring a class named 'Function' is deprecated.",
|
||||
correction: "Try renaming the class.",
|
||||
correctionMessage: "Try renaming the class.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -329,7 +329,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_IMPLEMENTS_FUNCTION = HintCode(
|
||||
'DEPRECATED_SUBTYPE_OF_FUNCTION',
|
||||
"Implementing 'Function' has no effect.",
|
||||
correction: "Try removing 'Function' from the 'implements' clause.",
|
||||
correctionMessage: "Try removing 'Function' from the 'implements' clause.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'DEPRECATED_IMPLEMENTS_FUNCTION',
|
||||
);
|
||||
|
@ -361,7 +361,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_MEMBER_USE = HintCode(
|
||||
'DEPRECATED_MEMBER_USE',
|
||||
"'{0}' is deprecated and shouldn't be used.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try replacing the use of the deprecated member with the replacement.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -393,7 +393,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE = HintCode(
|
||||
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
|
||||
"'{0}' is deprecated and shouldn't be used.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try replacing the use of the deprecated member with the replacement.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -407,7 +407,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
|
||||
"'{0}' is deprecated and shouldn't be used. {1}.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try replacing the use of the deprecated member with the replacement.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE',
|
||||
|
@ -421,7 +421,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_MEMBER_USE_WITH_MESSAGE = HintCode(
|
||||
'DEPRECATED_MEMBER_USE',
|
||||
"'{0}' is deprecated and shouldn't be used. {1}.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try replacing the use of the deprecated member with the replacement.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'DEPRECATED_MEMBER_USE_WITH_MESSAGE',
|
||||
|
@ -433,7 +433,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DEPRECATED_MIXIN_FUNCTION = HintCode(
|
||||
'DEPRECATED_SUBTYPE_OF_FUNCTION',
|
||||
"Mixing in 'Function' is deprecated.",
|
||||
correction: "Try removing 'Function' from the 'with' clause.",
|
||||
correctionMessage: "Try removing 'Function' from the 'with' clause.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'DEPRECATED_MIXIN_FUNCTION',
|
||||
);
|
||||
|
@ -444,7 +444,8 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DIVISION_OPTIMIZATION = HintCode(
|
||||
'DIVISION_OPTIMIZATION',
|
||||
"The operator x ~/ y is more efficient than (x / y).toInt().",
|
||||
correction: "Try re-writing the expression to use the '~/' operator.",
|
||||
correctionMessage:
|
||||
"Try re-writing the expression to use the '~/' operator.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -488,7 +489,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DUPLICATE_HIDDEN_NAME = HintCode(
|
||||
'DUPLICATE_HIDDEN_NAME',
|
||||
"Duplicate hidden name.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the repeated name from the list of hidden members.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -542,7 +543,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DUPLICATE_IGNORE = HintCode(
|
||||
'DUPLICATE_IGNORE',
|
||||
"The diagnostic '{0}' doesn't need to be ignored here because it's already being ignored.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -581,7 +582,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DUPLICATE_IMPORT = HintCode(
|
||||
'DUPLICATE_IMPORT',
|
||||
"Duplicate import.",
|
||||
correction: "Try removing all but one import of the library.",
|
||||
correctionMessage: "Try removing all but one import of the library.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -626,7 +627,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode DUPLICATE_SHOWN_NAME = HintCode(
|
||||
'DUPLICATE_SHOWN_NAME',
|
||||
"Duplicate shown name.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the repeated name from the list of shown members.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -677,7 +678,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode EQUAL_ELEMENTS_IN_SET = HintCode(
|
||||
'EQUAL_ELEMENTS_IN_SET',
|
||||
"Two elements in a set literal shouldn't be equal.",
|
||||
correction: "Change or remove the duplicate element.",
|
||||
correctionMessage: "Change or remove the duplicate element.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -726,7 +727,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode EQUAL_KEYS_IN_MAP = HintCode(
|
||||
'EQUAL_KEYS_IN_MAP',
|
||||
"Two keys in a map literal shouldn't be equal.",
|
||||
correction: "Change or remove the duplicate key.",
|
||||
correctionMessage: "Change or remove the duplicate key.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -741,7 +742,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
|
||||
"A file in the 'lib' directory shouldn't import a file outside the 'lib' directory.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the import, or moving the imported file inside the 'lib' directory.",
|
||||
);
|
||||
|
||||
|
@ -756,7 +757,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
|
||||
"A file outside the 'lib' directory shouldn't reference a file inside the 'lib' directory using a relative path.",
|
||||
correction: "Try using a package: URI instead.",
|
||||
correctionMessage: "Try using a package: URI instead.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -835,7 +836,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = HintCode(
|
||||
'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
|
||||
"The imported library defines a top-level function named 'loadLibrary' that is hidden by deferring this library.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try changing the import to not be deferred, or rename the function in the imported library.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -846,7 +847,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE = HintCode(
|
||||
'IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE',
|
||||
"The library '{0}' is legacy, and should not be imported into a null safe library.",
|
||||
correction: "Try migrating the imported library.",
|
||||
correctionMessage: "Try migrating the imported library.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -856,7 +857,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_COLLECTION_LITERAL = HintCode(
|
||||
'INFERENCE_FAILURE_ON_COLLECTION_LITERAL',
|
||||
"The type argument(s) of '{0}' can't be inferred.",
|
||||
correction: "Use explicit type argument(s) for '{0}'.",
|
||||
correctionMessage: "Use explicit type argument(s) for '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -866,7 +867,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_FUNCTION_INVOCATION = HintCode(
|
||||
'INFERENCE_FAILURE_ON_FUNCTION_INVOCATION',
|
||||
"The type argument(s) of the function '{0}' can't be inferred.",
|
||||
correction: "Use explicit type argument(s) for '{0}'.",
|
||||
correctionMessage: "Use explicit type argument(s) for '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -879,7 +880,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE = HintCode(
|
||||
'INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE',
|
||||
"The return type of '{0}' cannot be inferred.",
|
||||
correction: "Declare the return type of '{0}'.",
|
||||
correctionMessage: "Declare the return type of '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -889,7 +890,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_GENERIC_INVOCATION = HintCode(
|
||||
'INFERENCE_FAILURE_ON_GENERIC_INVOCATION',
|
||||
"The type argument(s) of the generic function type '{0}' can't be inferred.",
|
||||
correction: "Use explicit type argument(s) for '{0}'.",
|
||||
correctionMessage: "Use explicit type argument(s) for '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -900,7 +901,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_INSTANCE_CREATION = HintCode(
|
||||
'INFERENCE_FAILURE_ON_INSTANCE_CREATION',
|
||||
"The type argument(s) of the constructor '{0}' can't be inferred.",
|
||||
correction: "Use explicit type argument(s) for '{0}'.",
|
||||
correctionMessage: "Use explicit type argument(s) for '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -910,7 +911,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE = HintCode(
|
||||
'INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE',
|
||||
"The type of {0} can't be inferred without either a type or initializer.",
|
||||
correction: "Try specifying the type of the variable.",
|
||||
correctionMessage: "Try specifying the type of the variable.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -920,7 +921,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INFERENCE_FAILURE_ON_UNTYPED_PARAMETER = HintCode(
|
||||
'INFERENCE_FAILURE_ON_UNTYPED_PARAMETER',
|
||||
"The type of {0} can't be inferred; a type must be explicitly provided.",
|
||||
correction: "Try specifying the type of the parameter.",
|
||||
correctionMessage: "Try specifying the type of the parameter.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -943,7 +944,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_EXPORT_OF_INTERNAL_ELEMENT = HintCode(
|
||||
'INVALID_EXPORT_OF_INTERNAL_ELEMENT',
|
||||
"The member '{0}' can't be exported as a part of a package's public API.",
|
||||
correction: "Try using a hide clause to hide '{0}'.",
|
||||
correctionMessage: "Try using a hide clause to hide '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -957,7 +958,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY',
|
||||
"The member '{0}' can't be exported as a part of a package's public API, but is indirectly exported as part of the signature of '{1}'.",
|
||||
correction: "Try using a hide clause to hide '{0}'.",
|
||||
correctionMessage: "Try using a hide clause to hide '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1024,7 +1025,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override number must begin with '@dart'",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN',
|
||||
);
|
||||
|
@ -1044,7 +1045,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override comment must be specified with an '=' character",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS',
|
||||
);
|
||||
|
@ -1052,14 +1053,14 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_GREATER = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The language version override can't specify a version greater than the latest known language version: {0}.{1}",
|
||||
correction: "Try removing the language version override.",
|
||||
correctionMessage: "Try removing the language version override.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_GREATER',
|
||||
);
|
||||
|
||||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_LOCATION = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The language version override must be before any declaration or directive.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try moving the language version override to the top of the file.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOCATION',
|
||||
);
|
||||
|
@ -1079,7 +1080,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override comment must be specified with the word 'dart' in all lower case",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE',
|
||||
);
|
||||
|
@ -1099,7 +1100,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override comment must be specified with a version number, like '2.0', after the '=' character.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER',
|
||||
);
|
||||
|
@ -1119,7 +1120,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX = HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override number can't be prefixed with a letter",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX',
|
||||
);
|
||||
|
@ -1140,7 +1141,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override comment can't be followed by any non-whitespace characters",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS',
|
||||
);
|
||||
|
@ -1161,7 +1162,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'INVALID_LANGUAGE_VERSION_OVERRIDE',
|
||||
"The Dart language version override comment must be specified with exactly two slashes.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Specify a Dart language version override with a comment like '// @dart = 2.0'.",
|
||||
uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES',
|
||||
);
|
||||
|
@ -1237,7 +1238,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_NON_VIRTUAL_ANNOTATION = HintCode(
|
||||
'INVALID_NON_VIRTUAL_ANNOTATION',
|
||||
"The member '{0}' can't be '@nonVirtual' because it isn't a concrete instance member.",
|
||||
correction: "Try removing @nonVirtual.",
|
||||
correctionMessage: "Try removing @nonVirtual.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1263,7 +1264,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_REQUIRED_NAMED_PARAM = HintCode(
|
||||
'INVALID_REQUIRED_NAMED_PARAM',
|
||||
"The type parameter '{0}' is annotated with @required but only named parameters without a default value can be annotated with it.",
|
||||
correction: "Remove @required.",
|
||||
correctionMessage: "Remove @required.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1276,7 +1277,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM = HintCode(
|
||||
'INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM',
|
||||
"Incorrect use of the annotation @required on the optional positional parameter '{0}'. Optional positional parameters cannot be required.",
|
||||
correction: "Remove @required.",
|
||||
correctionMessage: "Remove @required.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1289,7 +1290,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_REQUIRED_POSITIONAL_PARAM = HintCode(
|
||||
'INVALID_REQUIRED_POSITIONAL_PARAM',
|
||||
"Redundant use of the annotation @required on the required positional parameter '{0}'.",
|
||||
correction: "Remove @required.",
|
||||
correctionMessage: "Remove @required.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1302,7 +1303,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode INVALID_SEALED_ANNOTATION = HintCode(
|
||||
'INVALID_SEALED_ANNOTATION',
|
||||
"The member '{0}' is annotated with '@sealed' but only classes can be annotated with it.",
|
||||
correction: "Remove @sealed.",
|
||||
correctionMessage: "Remove @sealed.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1496,7 +1497,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode MISSING_JS_LIB_ANNOTATION = HintCode(
|
||||
'MISSING_JS_LIB_ANNOTATION',
|
||||
"The @JS() annotation can only be used if it is also declared on the library directive.",
|
||||
correction: "Try adding the annotation to the library directive.",
|
||||
correctionMessage: "Try adding the annotation to the library directive.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1594,7 +1595,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode MISSING_RETURN = HintCode(
|
||||
'MISSING_RETURN',
|
||||
"This function has a return type of '{0}', but doesn't end with a return statement.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try adding a return statement, or changing the return type to 'void'.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -1642,7 +1643,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode MIXIN_ON_SEALED_CLASS = HintCode(
|
||||
'MIXIN_ON_SEALED_CLASS',
|
||||
"The class '{0}' shouldn't be used as a mixin constraint because it is sealed, and any class mixing in this mixin must have '{0}' as a superclass.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try composing with this class, or refer to its documentation for more information.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -1808,7 +1809,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR = HintCode(
|
||||
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
|
||||
"This instance creation must be 'const', because the {0} constructor is marked as '@literal'.",
|
||||
correction: "Try adding a 'const' keyword.",
|
||||
correctionMessage: "Try adding a 'const' keyword.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -1823,7 +1824,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
HintCode(
|
||||
'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR',
|
||||
"This instance creation must be 'const', because the {0} constructor is marked as '@literal'.",
|
||||
correction: "Try replacing the 'new' keyword with 'const'.",
|
||||
correctionMessage: "Try replacing the 'new' keyword with 'const'.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
|
||||
);
|
||||
|
@ -1867,7 +1868,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode NULLABLE_TYPE_IN_CATCH_CLAUSE = HintCode(
|
||||
'NULLABLE_TYPE_IN_CATCH_CLAUSE',
|
||||
"A potentially nullable type can't be used in an 'on' clause because it isn't valid to throw a nullable expression.",
|
||||
correction: "Try using a non-nullable type.",
|
||||
correctionMessage: "Try using a non-nullable type.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -1908,7 +1909,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode NULL_ARGUMENT_TO_NON_NULL_TYPE = HintCode(
|
||||
'NULL_ARGUMENT_TO_NON_NULL_TYPE',
|
||||
"'{0}' shouldn't be called with a null argument for the non-nullable type argument '{1}'.",
|
||||
correction: "Try adding a non-null argument.",
|
||||
correctionMessage: "Try adding a non-null argument.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1927,7 +1928,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode NULL_AWARE_IN_CONDITION = HintCode(
|
||||
'NULL_AWARE_IN_CONDITION',
|
||||
"The value of the '?.' operator can be 'null', which isn't appropriate in a condition.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try replacing the '?.' with a '.', testing the left-hand side for null if necessary.",
|
||||
);
|
||||
|
||||
|
@ -1957,7 +1958,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
|
||||
"The field doesn't override an inherited getter or setter.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try updating this class to match the superclass, or removing the override annotation.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_FIELD',
|
||||
|
@ -1971,7 +1972,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
|
||||
"The getter doesn't override an inherited getter.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try updating this class to match the superclass, or removing the override annotation.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_GETTER',
|
||||
|
@ -2019,7 +2020,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
|
||||
"The method doesn't override an inherited method.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try updating this class to match the superclass, or removing the override annotation.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_METHOD',
|
||||
|
@ -2033,7 +2034,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_MEMBER',
|
||||
"The setter doesn't override an inherited setter.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try updating this class to match the superclass, or removing the override annotation.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_SETTER',
|
||||
|
@ -2067,7 +2068,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode RECEIVER_OF_TYPE_NEVER = HintCode(
|
||||
'RECEIVER_OF_TYPE_NEVER',
|
||||
"The receiver is of type 'Never', and will never complete with a value.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try checking for throw expressions or type errors in the receiver",
|
||||
);
|
||||
|
||||
|
@ -2078,7 +2079,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode RETURN_OF_DO_NOT_STORE = HintCode(
|
||||
'RETURN_OF_DO_NOT_STORE',
|
||||
"'{0}' is annotated with 'doNotStore' and shouldn't be returned unless '{1}' is also annotated.",
|
||||
correction: "Annotate '{1}' with 'doNotStore'.",
|
||||
correctionMessage: "Annotate '{1}' with 'doNotStore'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -2204,7 +2205,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_ASYNC_EXPORTED_FROM_CORE = HintCode(
|
||||
'SDK_VERSION_ASYNC_EXPORTED_FROM_CORE',
|
||||
"The class '{0}' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try either importing 'dart:async' or updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -2260,7 +2261,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT = HintCode(
|
||||
'SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT',
|
||||
"The use of an as expression in a constant expression wasn't supported until version 2.3.2, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2318,7 +2319,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT = HintCode(
|
||||
'SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT',
|
||||
"The use of the operator '{0}' for 'bool' operands in a constant context wasn't supported until version 2.3.2, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2376,7 +2377,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_CONSTRUCTOR_TEAROFFS = HintCode(
|
||||
'SDK_VERSION_CONSTRUCTOR_TEAROFFS',
|
||||
"Tearing off a constructor requires the 'constructor-tearoffs' language feature.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try updating your pubspec.yaml to set the minimum SDK constraint to 2.15 or higher, and running 'pub get'.",
|
||||
);
|
||||
|
||||
|
@ -2437,7 +2438,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT = HintCode(
|
||||
'SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT',
|
||||
"Using the operator '==' for non-primitive types wasn't supported until version 2.3.2, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2497,7 +2498,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_EXTENSION_METHODS = HintCode(
|
||||
'SDK_VERSION_EXTENSION_METHODS',
|
||||
"Extension methods weren't supported until version 2.6.0, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2556,7 +2557,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_GT_GT_GT_OPERATOR = HintCode(
|
||||
'SDK_VERSION_GT_GT_GT_OPERATOR',
|
||||
"The operator '>>>' wasn't supported until version 2.14.0, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -2611,7 +2612,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT = HintCode(
|
||||
'SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT',
|
||||
"The use of an is expression in a constant context wasn't supported until version 2.3.2, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2663,7 +2664,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_NEVER = HintCode(
|
||||
'SDK_VERSION_NEVER',
|
||||
"The type 'Never' wasn't supported until version 2.12.0, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2714,7 +2715,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_SET_LITERAL = HintCode(
|
||||
'SDK_VERSION_SET_LITERAL',
|
||||
"Set literals weren't supported until version 2.2, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2774,7 +2775,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_UI_AS_CODE = HintCode(
|
||||
'SDK_VERSION_UI_AS_CODE',
|
||||
"The for, if, and spread elements weren't supported until version 2.3.0, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2836,7 +2837,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT = HintCode(
|
||||
'SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT',
|
||||
"The if and spread elements weren't supported in constant expressions until version 2.5.0, but this code is required to be able to run on earlier versions.",
|
||||
correction: "Try updating the SDK constraints.",
|
||||
correctionMessage: "Try updating the SDK constraints.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -2849,7 +2850,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode STRICT_RAW_TYPE = HintCode(
|
||||
'STRICT_RAW_TYPE',
|
||||
"The generic type '{0}' should have explicit type arguments but doesn't.",
|
||||
correction: "Use explicit type arguments for '{0}'.",
|
||||
correctionMessage: "Use explicit type arguments for '{0}'.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -2905,7 +2906,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode SUBTYPE_OF_SEALED_CLASS = HintCode(
|
||||
'SUBTYPE_OF_SEALED_CLASS',
|
||||
"The class '{0}' shouldn't be extended, mixed in, or implemented because it's sealed.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try composing instead of inheriting, or refer to the documentation of '{0}' for more information.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -2961,7 +2962,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode TYPE_CHECK_IS_NOT_NULL = HintCode(
|
||||
'TYPE_CHECK_WITH_NULL',
|
||||
"Tests for non-null should be done with '!= null'.",
|
||||
correction: "Try replacing the 'is! Null' check with '!= null'.",
|
||||
correctionMessage: "Try replacing the 'is! Null' check with '!= null'.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'TYPE_CHECK_IS_NOT_NULL',
|
||||
);
|
||||
|
@ -2972,7 +2973,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode TYPE_CHECK_IS_NULL = HintCode(
|
||||
'TYPE_CHECK_WITH_NULL',
|
||||
"Tests for null should be done with '== null'.",
|
||||
correction: "Try replacing the 'is Null' check with '== null'.",
|
||||
correctionMessage: "Try replacing the 'is Null' check with '== null'.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'TYPE_CHECK_IS_NULL',
|
||||
);
|
||||
|
@ -3011,7 +3012,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNDEFINED_HIDDEN_NAME = HintCode(
|
||||
'UNDEFINED_HIDDEN_NAME',
|
||||
"The library '{0}' doesn't export a member with the hidden name '{1}'.",
|
||||
correction: "Try removing the name from the list of hidden members.",
|
||||
correctionMessage: "Try removing the name from the list of hidden members.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3088,7 +3089,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNDEFINED_SHOWN_NAME = HintCode(
|
||||
'UNDEFINED_SHOWN_NAME',
|
||||
"The library '{0}' doesn't export a member with the shown name '{1}'.",
|
||||
correction: "Try removing the name from the list of shown members.",
|
||||
correctionMessage: "Try removing the name from the list of shown members.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3099,7 +3100,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNIGNORABLE_IGNORE = HintCode(
|
||||
'UNIGNORABLE_IGNORE',
|
||||
"The diagnostic '{0}' can't be ignored.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
|
||||
);
|
||||
|
||||
|
@ -3138,7 +3139,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_CAST = HintCode(
|
||||
'UNNECESSARY_CAST',
|
||||
"Unnecessary cast.",
|
||||
correction: "Try removing the cast.",
|
||||
correctionMessage: "Try removing the cast.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3149,7 +3150,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_IGNORE = HintCode(
|
||||
'UNNECESSARY_IGNORE',
|
||||
"The diagnostic '{0}' isn't produced at this location so it doesn't need to be ignored.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the name from the list, or removing the whole comment if this is the only name in the list.",
|
||||
);
|
||||
|
||||
|
@ -3203,7 +3204,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_IMPORT = HintCode(
|
||||
'UNNECESSARY_IMPORT',
|
||||
"The import of '{0}' is unnecessary because all of the used elements are also provided by the import of '{1}'.",
|
||||
correction: "Try removing the import directive.",
|
||||
correctionMessage: "Try removing the import directive.",
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -3255,7 +3256,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_NO_SUCH_METHOD = HintCode(
|
||||
'UNNECESSARY_NO_SUCH_METHOD',
|
||||
"Unnecessary 'noSuchMethod' declaration.",
|
||||
correction: "Try removing the declaration of 'noSuchMethod'.",
|
||||
correctionMessage: "Try removing the declaration of 'noSuchMethod'.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3316,7 +3317,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_NULL_COMPARISON_FALSE = HintCode(
|
||||
'UNNECESSARY_NULL_COMPARISON',
|
||||
"The operand can't be null, so the condition is always false.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the condition, an enclosing condition, or the whole conditional statement.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'UNNECESSARY_NULL_COMPARISON_FALSE',
|
||||
|
@ -3328,7 +3329,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_NULL_COMPARISON_TRUE = HintCode(
|
||||
'UNNECESSARY_NULL_COMPARISON',
|
||||
"The operand can't be null, so the condition is always true.",
|
||||
correction: "Remove the condition.",
|
||||
correctionMessage: "Remove the condition.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'UNNECESSARY_NULL_COMPARISON_TRUE',
|
||||
);
|
||||
|
@ -3399,7 +3400,8 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = HintCode(
|
||||
'UNNECESSARY_TYPE_CHECK',
|
||||
"Unnecessary type check; the result is always 'false'.",
|
||||
correction: "Try correcting the type check, or removing the type check.",
|
||||
correctionMessage:
|
||||
"Try correcting the type check, or removing the type check.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'UNNECESSARY_TYPE_CHECK_FALSE',
|
||||
);
|
||||
|
@ -3410,7 +3412,8 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = HintCode(
|
||||
'UNNECESSARY_TYPE_CHECK',
|
||||
"Unnecessary type check; the result is always 'true'.",
|
||||
correction: "Try correcting the type check, or removing the type check.",
|
||||
correctionMessage:
|
||||
"Try correcting the type check, or removing the type check.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'UNNECESSARY_TYPE_CHECK_TRUE',
|
||||
);
|
||||
|
@ -3455,7 +3458,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_CATCH_CLAUSE = HintCode(
|
||||
'UNUSED_CATCH_CLAUSE',
|
||||
"The exception variable '{0}' isn't used, so the 'catch' clause can be removed.",
|
||||
correction: "Try removing the catch clause.",
|
||||
correctionMessage: "Try removing the catch clause.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3500,7 +3503,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_CATCH_STACK = HintCode(
|
||||
'UNUSED_CATCH_STACK',
|
||||
"The stack trace variable '{0}' isn't used and can be removed.",
|
||||
correction: "Try removing the stack trace variable, or using it.",
|
||||
correctionMessage: "Try removing the stack trace variable, or using it.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3556,7 +3559,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_ELEMENT = HintCode(
|
||||
'UNUSED_ELEMENT',
|
||||
"The declaration '{0}' isn't referenced.",
|
||||
correction: "Try removing the declaration of '{0}'.",
|
||||
correctionMessage: "Try removing the declaration of '{0}'.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3567,7 +3570,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_ELEMENT_PARAMETER = HintCode(
|
||||
'UNUSED_ELEMENT',
|
||||
"A value for optional parameter '{0}' isn't ever given.",
|
||||
correction: "Try removing the unused parameter.",
|
||||
correctionMessage: "Try removing the unused parameter.",
|
||||
hasPublishedDocs: true,
|
||||
uniqueName: 'UNUSED_ELEMENT_PARAMETER',
|
||||
);
|
||||
|
@ -3609,7 +3612,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_FIELD = HintCode(
|
||||
'UNUSED_FIELD',
|
||||
"The value of the field '{0}' isn't used.",
|
||||
correction: "Try removing the field, or using it.",
|
||||
correctionMessage: "Try removing the field, or using it.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3643,7 +3646,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_IMPORT = HintCode(
|
||||
'UNUSED_IMPORT',
|
||||
"Unused import: '{0}'.",
|
||||
correction: "Try removing the import directive.",
|
||||
correctionMessage: "Try removing the import directive.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3695,7 +3698,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_LABEL = HintCode(
|
||||
'UNUSED_LABEL',
|
||||
"The label '{0}' isn't used.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try removing the label, or using it in either a 'break' or 'continue' statement.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -3728,7 +3731,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_LOCAL_VARIABLE = HintCode(
|
||||
'UNUSED_LOCAL_VARIABLE',
|
||||
"The value of the local variable '{0}' isn't used.",
|
||||
correction: "Try removing the variable or using it.",
|
||||
correctionMessage: "Try removing the variable or using it.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3805,7 +3808,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_RESULT = HintCode(
|
||||
'UNUSED_RESULT',
|
||||
"The value of '{0}' should be used.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try using the result by invoking a member, passing it to a function, or returning it from this function.",
|
||||
);
|
||||
|
||||
|
@ -3821,7 +3824,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_RESULT_WITH_MESSAGE = HintCode(
|
||||
'UNUSED_RESULT',
|
||||
"'{0}' should be used. {1}.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try using the result by invoking a member, passing it to a function, or returning it from this function.",
|
||||
uniqueName: 'UNUSED_RESULT_WITH_MESSAGE',
|
||||
);
|
||||
|
@ -3859,7 +3862,7 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode UNUSED_SHOWN_NAME = HintCode(
|
||||
'UNUSED_SHOWN_NAME',
|
||||
"The name {0} is shown, but isn’t used.",
|
||||
correction: "Try removing the name from the list of shown members.",
|
||||
correctionMessage: "Try removing the name from the list of shown members.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -3888,23 +3891,23 @@ class HintCode extends AnalyzerErrorCode {
|
|||
static const HintCode USE_OF_NATIVE_EXTENSION = HintCode(
|
||||
'USE_OF_NATIVE_EXTENSION',
|
||||
"Dart native extensions are deprecated and aren’t available in Dart 2.15.",
|
||||
correction: "Try using dart:ffi for C interop.",
|
||||
correctionMessage: "Try using dart:ffi for C interop.",
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const HintCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'HintCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
|
|
@ -12,12 +12,13 @@ import 'package:analyzer/error/error.dart';
|
|||
class LintCode extends ErrorCode {
|
||||
const LintCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
@Deprecated('Use correctionMessage instead') String? correction,
|
||||
String? correctionMessage,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
message: message,
|
||||
correctionMessage: correctionMessage ?? correction,
|
||||
problemMessage: problemMessage,
|
||||
name: name,
|
||||
uniqueName: uniqueName ?? 'LintCode.$name',
|
||||
);
|
||||
|
@ -28,6 +29,9 @@ class LintCode extends ErrorCode {
|
|||
@override
|
||||
int get hashCode => uniqueName.hashCode;
|
||||
|
||||
@Deprecated('Use problemMessage instead')
|
||||
String get message => problemMessage;
|
||||
|
||||
@override
|
||||
ErrorType get type => ErrorType.LINT;
|
||||
|
||||
|
@ -44,10 +48,11 @@ class LintCode extends ErrorCode {
|
|||
/// The primary difference from [LintCode]s is that these codes cannot be
|
||||
/// suppressed with `// ignore:` or `// ignore_for_file:` comments.
|
||||
class SecurityLintCode extends LintCode {
|
||||
const SecurityLintCode(String name, String message,
|
||||
{String? uniqueName, String? correction})
|
||||
: super(name, message,
|
||||
uniqueName: uniqueName ?? 'LintCode.$name', correction: correction);
|
||||
const SecurityLintCode(String name, String problemMessage,
|
||||
{String? uniqueName, String? correctionMessage})
|
||||
: super(name, problemMessage,
|
||||
uniqueName: uniqueName ?? 'LintCode.$name',
|
||||
correctionMessage: correctionMessage);
|
||||
|
||||
@override
|
||||
bool get isIgnorable => false;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -83,7 +83,7 @@ class TodoCode extends ErrorCode {
|
|||
*/
|
||||
const TodoCode(String name)
|
||||
: super(
|
||||
message: "{0}",
|
||||
problemMessage: "{0}",
|
||||
name: name,
|
||||
uniqueName: 'TodoCode.$name',
|
||||
);
|
||||
|
|
|
@ -8,18 +8,18 @@ import 'package:analyzer/error/error.dart';
|
|||
abstract class AnalyzerErrorCode extends ErrorCode {
|
||||
/// Initialize a newly created error code.
|
||||
const AnalyzerErrorCode({
|
||||
String? correction,
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
required String message,
|
||||
required String name,
|
||||
required String problemMessage,
|
||||
required String uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: uniqueName,
|
||||
);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,7 @@ const AnalysisOptionsHintCode DEPRECATED_LINT_HINT = AnalysisOptionsHintCode(
|
|||
const AnalysisOptionsHintCode DUPLICATE_RULE_HINT = AnalysisOptionsHintCode(
|
||||
'DUPLICATE_RULE',
|
||||
"The rule {0} is already specified and doesn't need to be specified again.",
|
||||
correction: "Try removing all but one specification of the rule.");
|
||||
correctionMessage: "Try removing all but one specification of the rule.");
|
||||
|
||||
/// An error code indicating an incompatible rule.
|
||||
///
|
||||
|
@ -39,7 +39,7 @@ const AnalysisOptionsHintCode DUPLICATE_RULE_HINT = AnalysisOptionsHintCode(
|
|||
const AnalysisOptionsWarningCode INCOMPATIBLE_LINT_WARNING =
|
||||
AnalysisOptionsWarningCode('INCOMPATIBLE_LINT_WARNING',
|
||||
"The rule '{0}' is incompatible with the rule '{1}'",
|
||||
correction: "Try removing one of the incompatible rules.");
|
||||
correctionMessage: "Try removing one of the incompatible rules.");
|
||||
|
||||
/// An error code indicating an undefined lint rule.
|
||||
///
|
||||
|
|
|
@ -22,7 +22,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
ManifestWarningCode(
|
||||
'CAMERA_PERMISSIONS_INCOMPATIBLE',
|
||||
"Camera permissions make app incompatible for Chrome OS, consider adding optional features \"android.hardware.camera\" and \"android.hardware.camera.autofocus\".",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try adding `<uses-feature android:name=\"android.hardware.camera\" android:required=\"false\">` `<uses-feature android:name=\"android.hardware.camera.autofocus\" android:required=\"false\">`.",
|
||||
);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
static const ManifestWarningCode NON_RESIZABLE_ACTIVITY = ManifestWarningCode(
|
||||
'NON_RESIZABLE_ACTIVITY',
|
||||
"The `<activity>` element should be allowed to be resized to allow users to take advantage of the multi-window environment on Chrome OS",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Consider declaring the corresponding activity element with `resizableActivity=\"true\"` attribute.",
|
||||
);
|
||||
|
||||
|
@ -43,7 +43,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
static const ManifestWarningCode NO_TOUCHSCREEN_FEATURE = ManifestWarningCode(
|
||||
'NO_TOUCHSCREEN_FEATURE',
|
||||
"The default \"android.hardware.touchscreen\" needs to be optional for Chrome OS. ",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Consider adding <uses-feature android:name=\"android.hardware.touchscreen\" android:required=\"false\" /> to the manifest.",
|
||||
);
|
||||
|
||||
|
@ -55,7 +55,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
ManifestWarningCode(
|
||||
'PERMISSION_IMPLIES_UNSUPPORTED_HARDWARE',
|
||||
"Permission makes app incompatible for Chrome OS, consider adding optional {0} feature tag, ",
|
||||
correction:
|
||||
correctionMessage:
|
||||
" Try adding `<uses-feature android:name=\"{0}\" android:required=\"false\">`.",
|
||||
);
|
||||
|
||||
|
@ -66,7 +66,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
ManifestWarningCode(
|
||||
'SETTING_ORIENTATION_ON_ACTIVITY',
|
||||
"The `<activity>` element should not be locked to any orientation so that users can take advantage of the multi-window environments and larger screens on Chrome OS",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Consider declaring the corresponding activity element with `screenOrientation=\"unspecified\"` or `\"fullSensor\"` attribute.",
|
||||
);
|
||||
|
||||
|
@ -77,7 +77,7 @@ class ManifestWarningCode extends ErrorCode {
|
|||
ManifestWarningCode(
|
||||
'UNSUPPORTED_CHROME_OS_FEATURE',
|
||||
"The feature {0} is not supported on Chrome OS, consider making it optional.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try changing to `android:required=\"false\"` for this feature.",
|
||||
);
|
||||
|
||||
|
@ -89,23 +89,24 @@ class ManifestWarningCode extends ErrorCode {
|
|||
ManifestWarningCode(
|
||||
'UNSUPPORTED_CHROME_OS_HARDWARE',
|
||||
"The feature {0} is not supported on Chrome OS, consider making it optional.",
|
||||
correction: "Try adding `android:required=\"false\"` for this feature.",
|
||||
correctionMessage:
|
||||
"Try adding `android:required=\"false\"` for this feature.",
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const ManifestWarningCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'ManifestWarningCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
PubspecWarningCode(
|
||||
'ASSET_DIRECTORY_DOES_NOT_EXIST',
|
||||
"The asset directory '{0}' doesn't exist.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try creating the directory or fixing the path to the directory.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -83,7 +83,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode ASSET_DOES_NOT_EXIST = PubspecWarningCode(
|
||||
'ASSET_DOES_NOT_EXIST',
|
||||
"The asset file '{0}' doesn't exist.",
|
||||
correction: "Try creating the file or fixing the path to the file.",
|
||||
correctionMessage: "Try creating the file or fixing the path to the file.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -121,7 +121,8 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode ASSET_FIELD_NOT_LIST = PubspecWarningCode(
|
||||
'ASSET_FIELD_NOT_LIST',
|
||||
"The value of the 'asset' field is expected to be a list of relative file paths.",
|
||||
correction: "Try converting the value to be a list of relative file paths.",
|
||||
correctionMessage:
|
||||
"Try converting the value to be a list of relative file paths.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -161,7 +162,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode ASSET_NOT_STRING = PubspecWarningCode(
|
||||
'ASSET_NOT_STRING',
|
||||
"Assets are required to be file paths (strings).",
|
||||
correction: "Try converting the value to be a string.",
|
||||
correctionMessage: "Try converting the value to be a string.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -199,7 +200,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
PubspecWarningCode(
|
||||
'DEPENDENCIES_FIELD_NOT_MAP',
|
||||
"The value of the '{0}' field is expected to be a map.",
|
||||
correction: "Try converting the value to be a map.",
|
||||
correctionMessage: "Try converting the value to be a map.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -234,7 +235,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode DEPRECATED_FIELD = PubspecWarningCode(
|
||||
'DEPRECATED_FIELD',
|
||||
"The '{0}' field is no longer used and can be removed.",
|
||||
correction: "Try removing the field.",
|
||||
correctionMessage: "Try removing the field.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -279,7 +280,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode FLUTTER_FIELD_NOT_MAP = PubspecWarningCode(
|
||||
'FLUTTER_FIELD_NOT_MAP',
|
||||
"The value of the 'flutter' field is expected to be a map.",
|
||||
correction: "Try converting the value to be a map.",
|
||||
correctionMessage: "Try converting the value to be a map.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -335,7 +336,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode INVALID_DEPENDENCY = PubspecWarningCode(
|
||||
'INVALID_DEPENDENCY',
|
||||
"Publishable packages can't have '{0}' dependencies.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try adding a 'publish_to: none' entry to mark the package as not for publishing or remove the {0} dependency.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -372,7 +373,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode MISSING_NAME = PubspecWarningCode(
|
||||
'MISSING_NAME',
|
||||
"The 'name' field is required but missing.",
|
||||
correction: "Try adding a field named 'name'.",
|
||||
correctionMessage: "Try adding a field named 'name'.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -406,7 +407,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode NAME_NOT_STRING = PubspecWarningCode(
|
||||
'NAME_NOT_STRING',
|
||||
"The value of the 'name' field is required to be a string.",
|
||||
correction: "Try converting the value to be a string.",
|
||||
correctionMessage: "Try converting the value to be a string.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -441,7 +442,8 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode PATH_DOES_NOT_EXIST = PubspecWarningCode(
|
||||
'PATH_DOES_NOT_EXIST',
|
||||
"The path '{0}' doesn't exist.",
|
||||
correction: "Try creating the referenced path or using a path that exists.",
|
||||
correctionMessage:
|
||||
"Try creating the referenced path or using a path that exists.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -473,7 +475,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode PATH_NOT_POSIX = PubspecWarningCode(
|
||||
'PATH_NOT_POSIX',
|
||||
"The path '{0}' isn't a POSIX-style path.",
|
||||
correction: "Try converting the value to a POSIX-style path.",
|
||||
correctionMessage: "Try converting the value to a POSIX-style path.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
|
@ -515,7 +517,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
PubspecWarningCode(
|
||||
'PATH_PUBSPEC_DOES_NOT_EXIST',
|
||||
"The directory '{0}' doesn't contain a pubspec.",
|
||||
correction:
|
||||
correctionMessage:
|
||||
"Try creating a pubspec in the referenced directory or using a path that has a pubspec.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
@ -560,24 +562,24 @@ class PubspecWarningCode extends ErrorCode {
|
|||
PubspecWarningCode(
|
||||
'UNNECESSARY_DEV_DEPENDENCY',
|
||||
"The dev dependency on {0} is unnecessary because there is also a normal dependency on that package.",
|
||||
correction: "Try removing the dev dependency.",
|
||||
correctionMessage: "Try removing the dev dependency.",
|
||||
hasPublishedDocs: true,
|
||||
);
|
||||
|
||||
/// Initialize a newly created error code to have the given [name].
|
||||
const PubspecWarningCode(
|
||||
String name,
|
||||
String message, {
|
||||
String? correction,
|
||||
String problemMessage, {
|
||||
String? correctionMessage,
|
||||
bool hasPublishedDocs = false,
|
||||
bool isUnresolvedIdentifier = false,
|
||||
String? uniqueName,
|
||||
}) : super(
|
||||
correction: correction,
|
||||
correctionMessage: correctionMessage,
|
||||
hasPublishedDocs: hasPublishedDocs,
|
||||
isUnresolvedIdentifier: isUnresolvedIdentifier,
|
||||
message: message,
|
||||
name: name,
|
||||
problemMessage: problemMessage,
|
||||
uniqueName: 'PubspecWarningCode.${uniqueName ?? name}',
|
||||
);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ main() {
|
|||
|
||||
const LintCode customCode = LintCode(
|
||||
'hash_and_equals', 'Override `==` if overriding `hashCode`.',
|
||||
correction: 'Implement `==`.');
|
||||
correctionMessage: 'Implement `==`.');
|
||||
|
||||
class CollectingReporter extends ErrorReporter {
|
||||
ErrorCode? code;
|
||||
|
|
|
@ -192,7 +192,7 @@ class ErrorCodeInfo {
|
|||
',');
|
||||
final correctionMessage = this.correctionMessage;
|
||||
if (correctionMessage is String) {
|
||||
out.write('correction: ');
|
||||
out.write('correctionMessage: ');
|
||||
out.writeln(json.encode(
|
||||
_convertTemplate(placeholderToIndexMap, correctionMessage)) +
|
||||
',');
|
||||
|
|
|
@ -223,8 +223,8 @@ void _generateYaml(Map<String, List<ErrorCode>> errorCodesByClass,
|
|||
var otherComment = commentInfo.otherComment;
|
||||
yamlCodes[uniqueNameSuffix] = ErrorCodeInfo(
|
||||
sharedName: uniqueNameSuffix == name ? null : name,
|
||||
problemMessage: code.message,
|
||||
correctionMessage: code.correction,
|
||||
problemMessage: code.problemMessage,
|
||||
correctionMessage: code.correctionMessage,
|
||||
isUnresolvedIdentifier: code.isUnresolvedIdentifier,
|
||||
hasPublishedDocs: code.hasPublishedDocs,
|
||||
comment: documentationComment,
|
||||
|
|
|
@ -207,17 +207,18 @@ class _AnalyzerErrorGenerator {
|
|||
out.writeln();
|
||||
out.writeln('/// Initialize a newly created error code to have the given '
|
||||
'[name].');
|
||||
out.writeln('const ${errorClass.name}(String name, String message, {');
|
||||
out.writeln('String? correction,');
|
||||
out.writeln(
|
||||
'const ${errorClass.name}(String name, String problemMessage, {');
|
||||
out.writeln('String? correctionMessage,');
|
||||
out.writeln('bool hasPublishedDocs = false,');
|
||||
out.writeln('bool isUnresolvedIdentifier = false,');
|
||||
out.writeln('String? uniqueName,');
|
||||
out.writeln('}) : super(');
|
||||
out.writeln('correction: correction,');
|
||||
out.writeln('correctionMessage: correctionMessage,');
|
||||
out.writeln('hasPublishedDocs: hasPublishedDocs,');
|
||||
out.writeln('isUnresolvedIdentifier: isUnresolvedIdentifier,');
|
||||
out.writeln('message: message,');
|
||||
out.writeln('name: name,');
|
||||
out.writeln('problemMessage: problemMessage,');
|
||||
out.writeln("uniqueName: '${errorClass.name}.\${uniqueName ?? name}',");
|
||||
out.writeln(');');
|
||||
out.writeln();
|
||||
|
|
|
@ -92,7 +92,7 @@ class MockErrorCode implements ErrorCode {
|
|||
MockErrorCode(this.type, this.errorSeverity, this.name);
|
||||
|
||||
@override
|
||||
String get correction {
|
||||
String get correctionMessage {
|
||||
throw StateError('Unexpected invocation of correction');
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class MockErrorCode implements ErrorCode {
|
|||
bool get isUnresolvedIdentifier => false;
|
||||
|
||||
@override
|
||||
String get message {
|
||||
String get problemMessage {
|
||||
throw StateError('Unexpected invocation of message');
|
||||
}
|
||||
|
||||
|
|
|
@ -35,14 +35,14 @@ class AnalyzerConverterTest extends _AnalyzerConverterTest {
|
|||
expect(pluginError, isNotNull);
|
||||
var location = pluginError.location;
|
||||
expect(pluginError.code, errorCode.name.toLowerCase());
|
||||
expect(pluginError.correction, errorCode.correction);
|
||||
expect(pluginError.correction, errorCode.correctionMessage);
|
||||
expect(location, isNotNull);
|
||||
expect(location.file, analyzerError.source.fullName);
|
||||
expect(location.length, analyzerError.length);
|
||||
expect(location.offset, analyzerError.offset);
|
||||
expect(location.startColumn, startColumn);
|
||||
expect(location.startLine, startLine);
|
||||
expect(pluginError.message, errorCode.message);
|
||||
expect(pluginError.message, errorCode.problemMessage);
|
||||
expect(pluginError.severity,
|
||||
converter.convertErrorSeverity(severity ?? errorCode.errorSeverity));
|
||||
expect(pluginError.type, converter.convertErrorType(errorCode.type));
|
||||
|
|
Loading…
Reference in a new issue