Skip to content

Commit 388a92b

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Remove deprecated DiagnosticOrErrorListener and friends
Change-Id: I06d91cd3e10e27afd10056dfac978d918f594c6e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464601 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent caf3336 commit 388a92b

File tree

4 files changed

+8
-27
lines changed

4 files changed

+8
-27
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
* **Breaking Change:** While the deprecated members mentioned above still exist in the AST,
1515
their parent nodes have changed. This means that code relying on specific parent-child
1616
relationships for these nodes might break.
17+
* **Breaking Change:** Remove deprecated `DiagnosticOrErrorListener` and the
18+
`DiagnosticOrErrorListenerExtension` extension.
19+
* **Breaking Change:** Remove deprecated `RecordingDiagnosticListener.onError`
20+
and `BooleanDiagnosticListener.onError` methods.
1721
* Deprecate `LintCode.new`'s `hasPublishedDocs` parameter.
1822
* Add `RemovedAnalysisRule` as the preferred way to represent removed lint
1923
rules. Deprecated `RuleState.removed` (which was the previous way to do so).

pkg/analyzer/api.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,14 +4612,12 @@ package:analyzer/error/listener.dart:
46124612
new (constructor: BooleanDiagnosticListener Function())
46134613
errorReported (getter: bool)
46144614
onDiagnostic (method: void Function(Diagnostic))
4615-
onError (method: void Function(Diagnostic), deprecated)
4616-
DiagnosticListener (class extends Object implements DiagnosticOrErrorListener):
4615+
DiagnosticListener (class extends Object):
46174616
nullListener (static getter: DiagnosticListener)
46184617
new (constructor: DiagnosticListener Function())
46194618
onDiagnostic (method: void Function(Diagnostic))
4620-
DiagnosticOrErrorListener (class extends Object, sealed (immediate subtypes: DiagnosticListener), deprecated)
46214619
DiagnosticReporter (class extends Object):
4622-
new (constructor: DiagnosticReporter Function(DiagnosticOrErrorListener, Source))
4620+
new (constructor: DiagnosticReporter Function(DiagnosticListener, Source))
46234621
lockLevel (getter: int)
46244622
lockLevel= (setter: int)
46254623
source (getter: Source)
@@ -4635,9 +4633,6 @@ package:analyzer/error/listener.dart:
46354633
new (constructor: RecordingDiagnosticListener Function())
46364634
diagnostics (getter: List<Diagnostic>)
46374635
onDiagnostic (method: void Function(Diagnostic))
4638-
onError (method: void Function(Diagnostic), deprecated)
4639-
DiagnosticOrErrorListenerExtension (extension on DiagnosticOrErrorListener):
4640-
onDiagnostic (method: void Function(Diagnostic))
46414636
ErrorReporter (type alias for DiagnosticReporter, deprecated)
46424637
package:analyzer/exception/exception.dart:
46434638
AnalysisException (class extends Object implements Exception):

pkg/analyzer/lib/error/listener.dart

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,15 @@ class BooleanDiagnosticListener implements DiagnosticListener {
2424
void onDiagnostic(Diagnostic diagnostic) {
2525
_diagnosticReported = true;
2626
}
27-
28-
@Deprecated("Call 'onDiagnostic' instead")
29-
void onError(Diagnostic diagnostic) => onDiagnostic(diagnostic);
3027
}
3128

32-
// ignore: deprecated_member_use_from_same_package
33-
abstract class DiagnosticListener implements DiagnosticOrErrorListener {
29+
abstract class DiagnosticListener {
3430
/// A diagnostic listener that ignores diagnostics that are reported to it.
3531
static const DiagnosticListener nullListener = _NullDiagnosticListener();
3632

3733
void onDiagnostic(Diagnostic diagnostic);
3834
}
3935

40-
@Deprecated("Use 'DiagnosticListener' instead")
41-
sealed class DiagnosticOrErrorListener {}
42-
4336
/// A diagnostic listener that records the diagnostics that are reported to it
4437
/// in a way that is appropriate for caching those diagnostic within an
4538
/// analysis context.
@@ -58,9 +51,6 @@ class RecordingDiagnosticListener implements DiagnosticListener {
5851
void onDiagnostic(Diagnostic diagnostic) {
5952
(_diagnostics ??= {}).add(diagnostic);
6053
}
61-
62-
@Deprecated("Call 'onDiagnostic' instead")
63-
void onError(Diagnostic diagnostic) => onDiagnostic(diagnostic);
6454
}
6555

6656
/// A [DiagnosticListener] that ignores everything.
@@ -72,10 +62,3 @@ class _NullDiagnosticListener implements DiagnosticListener {
7262
// Ignore diagnostics.
7363
}
7464
}
75-
76-
// ignore: deprecated_member_use_from_same_package
77-
extension DiagnosticOrErrorListenerExtension on DiagnosticOrErrorListener {
78-
void onDiagnostic(Diagnostic diagnostic) => switch (this) {
79-
DiagnosticListener self => self.onDiagnostic(diagnostic),
80-
};
81-
}

pkg/analyzer/lib/src/error/listener.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ Expected types: $expectedTypes''');
145145
@AnalyzerPublicApi(message: 'Exported by package:analyzer/error/listener.dart')
146146
class DiagnosticReporter {
147147
/// The diagnostic listener to which diagnostics are reported.
148-
// ignore: deprecated_member_use_from_same_package
149-
final DiagnosticOrErrorListener _diagnosticListener;
148+
final DiagnosticListener _diagnosticListener;
150149

151150
/// The source to be used when reporting diagnostics.
152151
final Source _source;

0 commit comments

Comments
 (0)