[analysis_server] Add type arguments to remaining raw types

The Maps are all JSON, so they become `Map<Object?, Object?>`.

Most other types get a `Object` or `Object?` type argument, and a
few also get `dynamic`.

Change-Id: I097318defed55360b5b0d910bd2d085a121e97b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287673
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index 8ce4f2d..5ff3124 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -3,8 +3,7 @@
 analyzer:
   language:
     strict-casts: true
-    # TODO(srawlins): Enable this; there are currently ~250 violations.
-    # strict-raw-types: true
+    strict-raw-types: true
   exclude:
     - test/mock_packages/**
   errors:
diff --git a/pkg/analysis_server/lib/protocol/protocol.dart b/pkg/analysis_server/lib/protocol/protocol.dart
index 1372285..d9fddbb 100644
--- a/pkg/analysis_server/lib/protocol/protocol.dart
+++ b/pkg/analysis_server/lib/protocol/protocol.dart
@@ -37,7 +37,7 @@
   Notification(this.event, [this.params]);
 
   /// Initialize a newly created instance based on the given JSON data.
-  factory Notification.fromJson(Map json) {
+  factory Notification.fromJson(Map<Object?, Object?> json) {
     return Notification(json[Notification.EVENT] as String,
         json[Notification.PARAMS] as Map<String, Object?>?);
   }
@@ -131,13 +131,7 @@
     return jsonObject;
   }
 
-  bool _equalLists(List? first, List? second) {
-    if (first == null) {
-      return second == null;
-    }
-    if (second == null) {
-      return false;
-    }
+  bool _equalLists(List<Object?> first, List<Object?> second) {
     var length = first.length;
     if (length != second.length) {
       return false;
@@ -150,13 +144,7 @@
     return true;
   }
 
-  bool _equalMaps(Map? first, Map? second) {
-    if (first == null) {
-      return second == null;
-    }
-    if (second == null) {
-      return false;
-    }
+  bool _equalMaps(Map<Object?, Object?> first, Map<Object?, Object?> second) {
     if (first.length != second.length) {
       return false;
     }
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index de57570..0ec8eb8 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -13379,7 +13379,7 @@
   RefactoringFeedback();
 
   static RefactoringFeedback? fromJson(JsonDecoder jsonDecoder, String jsonPath,
-      Object? json, Map responseJson) {
+      Object? json, Map<Object?, Object?> responseJson) {
     return refactoringFeedbackFromJson(
         jsonDecoder, jsonPath, json, responseJson);
   }
diff --git a/pkg/analysis_server/lib/src/channel/channel.dart b/pkg/analysis_server/lib/src/channel/channel.dart
index 14d0a62..aedac67 100644
--- a/pkg/analysis_server/lib/src/channel/channel.dart
+++ b/pkg/analysis_server/lib/src/channel/channel.dart
@@ -13,7 +13,7 @@
   final Converter<S, T> converter;
 
   /// The sink to which the converted chunks are added.
-  final Sink sink;
+  final Sink<T> sink;
 
   /// A flag indicating whether the sink has been closed.
   bool closed = false;
@@ -73,7 +73,8 @@
 class NotificationConverter
     extends Converter<Map<String, Object?>, Notification> {
   @override
-  Notification convert(Map input) => Notification.fromJson(input);
+  Notification convert(Map<Object?, Object?> input) =>
+      Notification.fromJson(input);
 
   @override
   ChunkedConversionSink<Map<String, Object?>> startChunkedConversion(
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 9df236f..710fbd6 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -388,7 +388,7 @@
             lineInfo: lineInfo, options: driver.analysisOptions);
 
         if (driver.analysisOptions.lint) {
-          var visitors = <LintRule, PubspecVisitor>{};
+          var visitors = <LintRule, PubspecVisitor<Object?>>{};
           for (var linter in driver.analysisOptions.lintRules) {
             if (linter is LintRule) {
               var visitor = linter.getPubspecVisitor();
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
index a9742c0..053f28e 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
@@ -19,7 +19,8 @@
 /// handler based on the command.
 class ExecuteCommandHandler
     extends MessageHandler<ExecuteCommandParams, Object?> {
-  final Map<String, CommandHandler> commandHandlers;
+  final Map<String, CommandHandler<ExecuteCommandParams, Object>>
+      commandHandlers;
 
   ExecuteCommandHandler(super.server)
       : commandHandlers = {
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
index 4942e54..8e5ba85 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart
@@ -236,7 +236,7 @@
 /// A message handler that handles all messages for a given server state.
 abstract class ServerStateMessageHandler {
   final LspAnalysisServer server;
-  final Map<Method, MessageHandler> _messageHandlers = {};
+  final Map<Method, MessageHandler<Object?, Object?>> _messageHandlers = {};
   final CancelRequestHandler _cancelHandler;
   final NotCancelableToken _notCancelableToken = NotCancelableToken();
 
@@ -286,7 +286,7 @@
         : error(ErrorCodes.MethodNotFound, 'Unknown method ${message.method}');
   }
 
-  void registerHandler(MessageHandler handler) {
+  void registerHandler(MessageHandler<Object?, Object?> handler) {
     _messageHandlers[handler.handlesMessage] = handler;
   }
 
diff --git a/pkg/analysis_server/lib/src/plugin/notification_manager.dart b/pkg/analysis_server/lib/src/plugin/notification_manager.dart
index caaa088..2e2fe59 100644
--- a/pkg/analysis_server/lib/src/plugin/notification_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/notification_manager.dart
@@ -224,7 +224,7 @@
       Map<server.AnalysisService, Set<String>> newSubscriptions) {
     /// Return the collector associated with the given service, or `null` if the
     /// service is not handled by this manager.
-    ResultCollector? collectorFor(server.AnalysisService service) {
+    ResultCollector<Object?>? collectorFor(server.AnalysisService service) {
       switch (service) {
         case server.AnalysisService.FOLDING:
           return folding;
diff --git a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
index 2f60283..0b27760 100644
--- a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
+++ b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart
@@ -96,8 +96,8 @@
 }
 
 /// Create a [RefactoringFeedback] corresponding the given [kind].
-RefactoringFeedback? refactoringFeedbackFromJson(
-    JsonDecoder jsonDecoder, String jsonPath, Object? json, Map feedbackJson) {
+RefactoringFeedback? refactoringFeedbackFromJson(JsonDecoder jsonDecoder,
+    String jsonPath, Object? json, Map<Object?, Object?> feedbackJson) {
   var kind = jsonDecoder.refactoringKind;
   if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) {
     return ExtractLocalVariableFeedback.fromJson(jsonDecoder, jsonPath, json);
diff --git a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
index 988a42d..e2f3ef0 100644
--- a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
+++ b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart
@@ -529,14 +529,13 @@
       .searchWithin(completionContext.resolveResult.unit);
 
   void _setCompletionFromBuilder(
-      ChangeBuilder builder, PostfixCompletionKind kind,
-      [List? args]) {
+      ChangeBuilder builder, PostfixCompletionKind kind) {
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       completion = null;
       return;
     }
-    change.message = formatList(kind.message, args);
+    change.message = formatList(kind.message, null);
     completion = PostfixCompletion(kind, change);
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
index f3531f1..4576f79 100644
--- a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
+++ b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart
@@ -1179,20 +1179,19 @@
   AstNode? _selectedNode({int? at}) =>
       NodeLocator(at ?? selectionOffset).searchWithin(unit);
 
-  void _setCompletion(StatementCompletionKind kind, [List? args]) {
+  void _setCompletion(StatementCompletionKind kind) {
     assert(exitPosition != null);
     change.selection = exitPosition;
-    change.message = formatList(kind.message, args);
+    change.message = formatList(kind.message, null);
     for (var group in linkedPositionGroups.values) {
       change.addLinkedEditGroup(group);
     }
     completion = StatementCompletion(kind, change);
   }
 
-  void _setCompletionAt(StatementCompletionKind kind, int offset,
-      [List? args]) {
+  void _setCompletionAt(StatementCompletionKind kind, int offset) {
     exitPosition = _newPosition(offset);
-    _setCompletion(kind, args);
+    _setCompletion(kind);
   }
 
   SourceBuilder _sourceBuilderAfterKeyword(AstNode node, Token keyword) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
index 8119c1a..f0ef74d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart
@@ -94,7 +94,7 @@
     }
     var data = <Object>[];
     for (var change in changes) {
-      var result = change.validate(this) as Object?;
+      var result = change.validate(this);
       if (result == null) {
         return;
       }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
index 5f89d6f..015102f 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
@@ -172,7 +172,11 @@
   /// Add a fix whose edits were built by the [builder] that has the given
   /// [kind]. If [args] are provided, they will be used to fill in the message
   /// for the fix.
-  void _addFixFromBuilder(ChangeBuilder builder, FixKind kind, {List? args}) {
+  void _addFixFromBuilder(
+    ChangeBuilder builder,
+    FixKind kind, {
+    required List<String> args,
+  }) {
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       return;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart
index cd8b2f5..afd5ea5 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart
@@ -10,21 +10,21 @@
 /// possible lists.
 abstract class ChangesSelector {
   /// Return the list of changes that should be applied based on the [context].
-  List<Change>? getChanges(TemplateContext context);
+  List<Change<Object>>? getChanges(TemplateContext context);
 }
 
 /// A changes selector that uses boolean-valued conditions to select the list.
 class ConditionalChangesSelector implements ChangesSelector {
   /// A table mapping the expressions to be evaluated to the changes that those
   /// conditions select.
-  final Map<Expression, List<Change>> changeMap;
+  final Map<Expression, List<Change<Object>>> changeMap;
 
   /// Initialize a newly created conditional changes selector with the changes
   /// in the [changeMap].
   ConditionalChangesSelector(this.changeMap);
 
   @override
-  List<Change>? getChanges(TemplateContext context) {
+  List<Change<Object>>? getChanges(TemplateContext context) {
     for (var entry in changeMap.entries) {
       var value = entry.key.evaluateIn(context);
       if (value is bool && value) {
@@ -38,14 +38,14 @@
 /// A changes selector that has a single, unconditional list of changes.
 class UnconditionalChangesSelector implements ChangesSelector {
   /// The list of changes to be returned.
-  final List<Change> changes;
+  final List<Change<Object>> changes;
 
   /// Initialize a newly created changes selector to return the given list of
   /// [changes].
   UnconditionalChangesSelector(this.changes);
 
   @override
-  List<Change> getChanges(TemplateContext context) {
+  List<Change<Object>> getChanges(TemplateContext context) {
     return changes;
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
index 350d7a7..c96e535 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
@@ -443,7 +443,7 @@
   /// Translate the [node] into a change. Return the resulting change, or `null`
   /// if the [node] does not represent a valid change. If the [node] is not
   /// valid, use the [context] to report the error.
-  Change? _translateChange(YamlNode node, ErrorContext context) {
+  Change<Object>? _translateChange(YamlNode node, ErrorContext context) {
     if (node is YamlMap) {
       var kindNode = node.valueAt(_kindKey);
       var kindContext = ErrorContext(key: _kindKey, parentNode: node);
@@ -554,7 +554,7 @@
   }
 
   void _translateConditionalChange(YamlNode node, ErrorContext context,
-      Map<Expression, List<Change>> changeMap) {
+      Map<Expression, List<Change<Object>>> changeMap) {
     if (node is YamlMap) {
       _reportUnsupportedKeys(node, const {_ifKey, _changesKey});
       var expressionNode = node.valueAt(_ifKey);
@@ -587,7 +587,7 @@
   ChangesSelector? _translateConditionalChanges(
       YamlNode node, ErrorContext context) {
     if (node is YamlList) {
-      var changeMap = <Expression, List<Change>>{};
+      var changeMap = <Expression, List<Change<Object>>>{};
       for (var element in node.nodes) {
         _translateConditionalChange(element, context, changeMap);
       }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart
index d0452f2..7565fab 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart
@@ -122,13 +122,13 @@
   /// Add a fix whose edits were built by the [builder] that has the given
   /// [kind]. If [args] are provided, they will be used to fill in the message
   /// for the fix.
-  void _addFixFromBuilder(ChangeBuilder builder, FixKind kind, {List? args}) {
+  void _addFixFromBuilder(ChangeBuilder builder, FixKind kind) {
     var change = builder.sourceChange;
     if (change.edits.isEmpty) {
       return;
     }
     change.id = kind.id;
-    change.message = formatList(kind.message, args);
+    change.message = formatList(kind.message, null);
     fixes.add(Fix(kind, change));
   }
 
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index 151412a..0a8eefd 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -780,7 +780,7 @@
     addedFiles.sort();
     implicitFiles.sort();
 
-    String lenCounter(List list) {
+    String lenCounter(List<String> list) {
       return '<span class="counter" style="float: right;">${list.length}</span>';
     }
 
diff --git a/pkg/analysis_server/lib/src/utilities/request_statistics.dart b/pkg/analysis_server/lib/src/utilities/request_statistics.dart
index 7cdf234..1379888 100644
--- a/pkg/analysis_server/lib/src/utilities/request_statistics.dart
+++ b/pkg/analysis_server/lib/src/utilities/request_statistics.dart
@@ -240,7 +240,7 @@
   }
 
   @override
-  void writeAll(Iterable objects, [String separator = '']) {
+  void writeAll(Iterable<Object?> objects, [String separator = '']) {
     throw UnimplementedError();
   }
 
diff --git a/pkg/analysis_server/test/completion_test_support.dart b/pkg/analysis_server/test/completion_test_support.dart
index a0ebd67..701324c 100644
--- a/pkg/analysis_server/test/completion_test_support.dart
+++ b/pkg/analysis_server/test/completion_test_support.dart
@@ -13,7 +13,7 @@
 class CompletionTestCase extends AbstractCompletionDomainTest {
   static const String CURSOR_MARKER = '!';
 
-  List get suggestedCompletions => suggestions
+  List<String> get suggestedCompletions => suggestions
       .map((CompletionSuggestion suggestion) => suggestion.completion)
       .toList();
 
diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart
index 91fd8b6..00835bc 100644
--- a/pkg/analysis_server/test/integration/support/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/support/integration_tests.dart
@@ -52,8 +52,8 @@
   fail(_defaultFailFormatter(actual, matcher, reason, matchState, verbose));
 }
 
-String _defaultFailFormatter(
-    actual, Matcher matcher, String? reason, Map matchState, bool verbose) {
+String _defaultFailFormatter(actual, Matcher matcher, String? reason,
+    Map<Object?, Object?> matchState, bool verbose) {
   var description = StringDescription();
   description.add('Expected: ').addDescriptionOf(matcher).add('\n');
   description.add('  Actual: ').addDescriptionOf(actual).add('\n');
@@ -76,7 +76,8 @@
     Description mismatchDescription);
 
 /// Type of callbacks used to process notifications.
-typedef NotificationProcessor = void Function(String event, Map params);
+typedef NotificationProcessor = void Function(
+    String event, Map<Object?, Object?> params);
 
 /// Base class for analysis server integration tests.
 abstract class AbstractAnalysisServerIntegrationTest extends IntegrationTest {
@@ -321,14 +322,14 @@
   }
 
   @override
-  Description describeMismatch(
-      item, Description mismatchDescription, Map matchState, bool verbose) {
+  Description describeMismatch(Object? item, Description mismatchDescription,
+      Map<Object?, Object?> matchState, bool verbose) {
     return _matcher.describeMismatch(
         item, mismatchDescription, matchState, verbose);
   }
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(dynamic item, Map<Object?, Object?> matchState) {
     return _matcher.matches(item, matchState);
   }
 }
@@ -348,7 +349,7 @@
       description.add(this.description);
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(item, Map<Object?, Object?> matchState) {
     return allowedValues.contains(item);
   }
 }
@@ -531,7 +532,7 @@
       }
 
       _recordStdio('<== $trimmedLine');
-      Map message;
+      Map<Object?, Object?> message;
       try {
         message = json.decoder.convert(trimmedLine) as Map<Object?, Object?>;
       } catch (exception) {
@@ -720,7 +721,7 @@
 
 /// An error result from a server request.
 class ServerErrorMessage {
-  final Map message;
+  final Map<Object?, Object?> message;
 
   ServerErrorMessage(this.message);
 
@@ -746,8 +747,8 @@
       description.add('List of ').addDescriptionOf(elementMatcher);
 
   @override
-  Description describeMismatch(
-      item, Description mismatchDescription, Map matchState, bool verbose) {
+  Description describeMismatch(item, Description mismatchDescription,
+      Map<Object?, Object?> matchState, bool verbose) {
     if (item is! List) {
       return super
           .describeMismatch(item, mismatchDescription, matchState, verbose);
@@ -758,7 +759,7 @@
   }
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(item, Map<Object?, Object?> matchState) {
     if (item is! List) {
       return false;
     }
@@ -834,7 +835,7 @@
   }
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(item, Map<Object?, Object?> matchState) {
     for (var choiceMatcher in choiceMatchers) {
       var subState = {};
       if (choiceMatcher.matches(item, subState)) {
@@ -879,8 +880,8 @@
   }
 
   @override
-  Description describeMismatch(
-      item, Description mismatchDescription, Map matchState, bool verbose) {
+  Description describeMismatch(item, Description mismatchDescription,
+      Map<Object?, Object?> matchState, bool verbose) {
     var mismatches = matchState['mismatches'] as List<MismatchDescriber>?;
     if (mismatches != null) {
       for (var i = 0; i < mismatches.length; i++) {
@@ -904,7 +905,7 @@
   }
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(item, Map<Object?, Object?> matchState) {
     var mismatches = <MismatchDescriber>[];
     populateMismatches(item, mismatches);
     if (mismatches.isEmpty) {
diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
index a3bfbb5..9f4b5a6 100644
--- a/pkg/analysis_server/test/mocks.dart
+++ b/pkg/analysis_server/test/mocks.dart
@@ -156,7 +156,7 @@
 
   @override
   Description describeMismatch(Object? item, Description mismatchDescription,
-      Map matchState, bool verbose) {
+      Map<Object?, Object?> matchState, bool verbose) {
     var response = item as Response;
     var id = response.id;
     var error = response.error;
@@ -170,7 +170,7 @@
   }
 
   @override
-  bool matches(Object? item, Map matchState) {
+  bool matches(Object? item, Map<Object?, Object?> matchState) {
     var response = item as Response;
     var error = response.error;
     if (response.id != _id || error == null) {
@@ -197,7 +197,7 @@
 
   @override
   Description describeMismatch(Object? item, Description mismatchDescription,
-      Map matchState, bool verbose) {
+      Map<Object?, Object?> matchState, bool verbose) {
     var response = item as Response?;
     if (response == null) {
       mismatchDescription.add('is null response');
@@ -213,7 +213,7 @@
   }
 
   @override
-  bool matches(Object? item, Map matchState) {
+  bool matches(Object? item, Map<Object?, Object?> matchState) {
     var response = item as Response?;
     return response != null && response.id == _id && response.error == null;
   }
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index 4b7756b..429b460 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -1377,7 +1377,7 @@
     return SearchGetTypeHierarchyResult.fromResponse(response).hierarchyItems;
   }
 
-  List _toJson(List<TypeHierarchyItem> items) {
+  List<Map<String, Object>> _toJson(List<TypeHierarchyItem> items) {
     return items.map((item) => item.toJson()).toList();
   }
 
diff --git a/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart b/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart
index 7a74ca5..b3814ed 100644
--- a/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart
+++ b/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart
@@ -486,7 +486,7 @@
       description.add('percentiles');
 
   @override
-  bool matches(Object? item, Map matchState) {
+  bool matches(Object? item, Map<Object?, Object?> matchState) {
     if (item is! String) {
       return false;
     }
@@ -514,7 +514,7 @@
       description.add('a string encoded positive integer');
 
   @override
-  bool matches(Object? item, Map matchState) {
+  bool matches(Object? item, Map<Object?, Object?> matchState) {
     if (item is! String) {
       return false;
     }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
index c3d8722..81dac00 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
@@ -780,7 +780,7 @@
 
   /// Assuming that the [transform] has a single list of changes associated with
   /// it, return the list of changes.
-  List<Change> _changes(Transform transform) =>
+  List<Change<Object>> _changes(Transform transform) =>
       (transform.changesSelector as UnconditionalChangesSelector).changes;
 
   ElementMatcher _matcher(String name) =>
diff --git a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
index 9702d0e..b9f7433 100644
--- a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
+++ b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart
@@ -249,7 +249,7 @@
       description.add(_value.toString());
 
   @override
-  bool matches(item, Map matchState) {
+  bool matches(item, Map<Object?, Object?> matchState) {
     return item is num &&
         num.parse(item.toStringAsFixed(fractionDigits)) ==
             num.parse(_value.toStringAsFixed(fractionDigits));
diff --git a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
index e8bafaf..f7a300b 100644
--- a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
@@ -556,7 +556,9 @@
     var humanReadableNameString = literalString(impliedType.humanReadableName);
     if (className == 'RefactoringFeedback') {
       writeln('static RefactoringFeedback? fromJson(JsonDecoder jsonDecoder, '
-          'String jsonPath, Object? json, Map responseJson) {');
+          'String jsonPath, '
+          'Object? json, '
+          'Map<Object?, Object?> responseJson) {');
       indent(() {
         writeln('return refactoringFeedbackFromJson(jsonDecoder, jsonPath, '
             'json, responseJson);');
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 2076786..ecdac45 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -13379,7 +13379,7 @@
   RefactoringFeedback();
 
   static RefactoringFeedback? fromJson(JsonDecoder jsonDecoder, String jsonPath,
-      Object? json, Map responseJson) {
+      Object? json, Map<Object?, Object?> responseJson) {
     return refactoringFeedbackFromJson(
         jsonDecoder, jsonPath, json, responseJson);
   }
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
index c43369c..4a4773e 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
@@ -3686,7 +3686,7 @@
   RefactoringFeedback();
 
   factory RefactoringFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath,
-      Object? json, Map responseJson) {
+      Object? json, Map<Object?, Object?> responseJson) {
     return refactoringFeedbackFromJson(
         jsonDecoder, jsonPath, json, responseJson);
   }
diff --git a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
index aa38822..462fb49 100644
--- a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
@@ -534,7 +534,9 @@
     var humanReadableNameString = literalString(impliedType.humanReadableName);
     if (className == 'RefactoringFeedback') {
       writeln('factory RefactoringFeedback.fromJson(JsonDecoder jsonDecoder, '
-          'String jsonPath, Object? json, Map responseJson) {');
+          'String jsonPath, '
+          'Object? json, '
+          'Map<Object?, Object?> responseJson) {');
       indent(() {
         writeln('return refactoringFeedbackFromJson(jsonDecoder, jsonPath, '
             'json, responseJson);');