Skip to content

Commit 05bcfd2

Browse files
scheglovCommit Queue
authored andcommitted
Breaking changes for analyzer version 9.0.0
Change-Id: I4d1b611edcf5340543b5cabf93b88a103408920b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444924 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent acad3c0 commit 05bcfd2

File tree

36 files changed

+96
-4035
lines changed

36 files changed

+96
-4035
lines changed

pkg/_fe_analyzer_shared/lib/src/base/errors.dart

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ class Diagnostic {
7171
/// being reported. The list will be empty if there are no such messages.
7272
final List<DiagnosticMessage> contextMessages;
7373

74-
/// Data associated with this diagnostic, specific for [diagnosticCode].
75-
@Deprecated('Use an expando instead')
76-
final Object? data;
77-
7874
/// A description of how to fix the problem, or `null` if there is no such
7975
/// description.
8076
final String? correctionMessage;
@@ -89,15 +85,11 @@ class Diagnostic {
8985
required this.source,
9086
required int offset,
9187
required int length,
92-
DiagnosticCode? diagnosticCode,
93-
@Deprecated("Pass a value for 'diagnosticCode' instead")
94-
DiagnosticCode? errorCode,
88+
required this.diagnosticCode,
9589
required String message,
9690
this.correctionMessage,
9791
this.contextMessages = const [],
98-
@Deprecated('Use an expando instead') this.data,
99-
}) : diagnosticCode = _useNonNullCodeBetween(diagnosticCode, errorCode),
100-
problemMessage = new DiagnosticMessageImpl(
92+
}) : problemMessage = new DiagnosticMessageImpl(
10193
filePath: source.fullName,
10294
length: length,
10395
message: message,
@@ -109,31 +101,27 @@ class Diagnostic {
109101
///
110102
/// The diagnostic is associated with the given [source] and is located at the
111103
/// given [offset] with the given [length]. The diagnostic will have the given
112-
/// [errorCode] and the list of [arguments] will be used to complete the
104+
/// [diagnosticCode] and the list of [arguments] will be used to complete the
113105
/// message and correction. If any [contextMessages] are provided, they will
114106
/// be recorded with the diagnostic.
115107
factory Diagnostic.tmp({
116108
required Source source,
117109
required int offset,
118110
required int length,
119-
DiagnosticCode? diagnosticCode,
120-
@Deprecated("Pass a value for 'diagnosticCode' instead")
121-
DiagnosticCode? errorCode,
111+
required DiagnosticCode diagnosticCode,
122112
List<Object?> arguments = const [],
123113
List<DiagnosticMessage> contextMessages = const [],
124-
@Deprecated('Use an expando instead') Object? data,
125114
}) {
126-
DiagnosticCode code = _useNonNullCodeBetween(diagnosticCode, errorCode);
127115
assert(
128-
arguments.length == code.numParameters,
129-
'Message $code requires ${code.numParameters} '
130-
'argument${code.numParameters == 1 ? '' : 's'}, but '
116+
arguments.length == diagnosticCode.numParameters,
117+
'Message $diagnosticCode requires ${diagnosticCode.numParameters} '
118+
'argument${diagnosticCode.numParameters == 1 ? '' : 's'}, but '
131119
'${arguments.length} '
132120
'argument${arguments.length == 1 ? ' was' : 's were'} '
133121
'provided',
134122
);
135-
String message = formatList(code.problemMessage, arguments);
136-
String? correctionTemplate = code.correctionMessage;
123+
String message = formatList(diagnosticCode.problemMessage, arguments);
124+
String? correctionTemplate = diagnosticCode.correctionMessage;
137125
String? correctionMessage;
138126
if (correctionTemplate != null) {
139127
correctionMessage = formatList(correctionTemplate, arguments);
@@ -143,12 +131,10 @@ class Diagnostic {
143131
source: source,
144132
offset: offset,
145133
length: length,
146-
diagnosticCode: code,
134+
diagnosticCode: diagnosticCode,
147135
message: message,
148136
correctionMessage: correctionMessage,
149137
contextMessages: contextMessages,
150-
// ignore: deprecated_member_use_from_same_package
151-
data: data,
152138
);
153139
}
154140

@@ -233,19 +219,6 @@ class Diagnostic {
233219
buffer.write(message);
234220
return buffer.toString();
235221
}
236-
237-
/// The non-`null` [DiagnosticCode] value between the two parameters.
238-
static DiagnosticCode _useNonNullCodeBetween(
239-
DiagnosticCode? diagnosticCode,
240-
DiagnosticCode? errorCode,
241-
) {
242-
if ((diagnosticCode == null) == (errorCode == null)) {
243-
throw new ArgumentError(
244-
"Exactly one of 'diagnosticCode' and 'errorCode' may be passed",
245-
);
246-
}
247-
return diagnosticCode ?? errorCode!;
248-
}
249222
}
250223

251224
/// Private subtype of [DiagnosticCode] that supports runtime checking of

pkg/analysis_server/test/protocol_server_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@ class MockDiagnostic implements engine.Diagnostic {
363363
@override
364364
String? get correctionMessage => _correctionMessage;
365365

366-
@override
367-
Object? get data => throw UnimplementedError();
368-
369366
@override
370367
engine.DiagnosticCode get diagnosticCode => _diagnosticCode!;
371368

pkg/analysis_server_plugin/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: analysis_server_plugin
22
description: A framework and support code for building plugins for the analysis server.
3-
version: 0.3.3
3+
version: 0.3.4-dev
44
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_plugin
55

66
environment:
@@ -11,8 +11,8 @@ resolution: workspace
1111
dependencies:
1212
# See the release policy for managing this dependency at
1313
# pkg/analyzer/doc/implementation/releasing.md.
14-
analyzer: 8.4.0
15-
analyzer_plugin: 0.13.10
14+
analyzer: ^9.0.0-0
15+
analyzer_plugin: 0.13.11-dev
1616
meta: ^1.16.0
1717
yaml: ^3.1.0
1818
yaml_edit: ^2.2.0

pkg/analyzer/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## 9.0.0-dev
2+
* Remove deprecated field `Diagnostic.data`.
3+
* In the method `DiagnosticReporter.atOffset` and the constructors
4+
`Diagnostic.tmp` and `Diagnostic.forValues`, remove the deprecated named
5+
parameter `errorCode`, and make the named parameter `diagnosticCode`
6+
non-nullable and required.
7+
* Remove deprecated `DiagnosticReporter.atOffset` named parameter, `errorCode`.
8+
* Remove deprecated `BooleanErrorListener`.
9+
* Remove deprecated `RecordingErrorListener`.
10+
* Remove deprecated `AnalysisErrorListener.NULL_LISTENER`.
11+
* Remove deprecated `AstNodeExtension`.
12+
* Remove deprecated `NullShortableExpression`.
13+
* Remove deprecated getters and methods from AST and element model.
14+
* Remove deprecated `PartDirective.configurations`.
15+
* Remove deprecated `TypeDefiningElement`.
16+
* Remove deprecated `TypeAliasElement.aliasedElement`.
17+
118
## 8.4.0
219
* Add the `experimental_member_use` warning, which warns about any reference to
320
a declaration annotated with `@experimental`.

0 commit comments

Comments
 (0)