analyzer: Remove deprecated AnalysisContextCollectionImpl.updateAnalysisOptions2 parameter

This parameter was deprecated in analyzer 7.4.0. It's also never been public API.

Change-Id: I3372c751ac1808bd6806b4312cfdcff0dd51faa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428061
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
index 360d337..bf6a744 100644
--- a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
@@ -3,7 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/dart/analysis/analysis_context_collection.dart';
-import 'package:analyzer/dart/analysis/context_root.dart';
 import 'package:analyzer/dart/analysis/declared_variables.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
@@ -56,13 +55,6 @@
     FileContentCache? fileContentCache,
     UnlinkedUnitStore? unlinkedUnitStore,
     InfoDeclarationStore? infoDeclarationStore,
-    @Deprecated('Use updateAnalysisOptions3 instead')
-    void Function({
-      required AnalysisOptionsImpl analysisOptions,
-      required ContextRoot contextRoot,
-      required DartSdk sdk,
-    })?
-    updateAnalysisOptions2,
     void Function({
       required AnalysisOptionsImpl analysisOptions,
       required DartSdk sdk,
@@ -75,13 +67,6 @@
 
     performanceLog ??= PerformanceLog(null);
 
-    if (updateAnalysisOptions2 != null && updateAnalysisOptions3 != null) {
-      throw ArgumentError(
-        'Only one of updateAnalysisOptions2 and updateAnalysisOptions3 may be '
-        'given',
-      );
-    }
-
     if (scheduler == null) {
       scheduler = AnalysisDriverScheduler(performanceLog);
       if (drainStreams) {
@@ -112,20 +97,7 @@
     var contextBuilder = ContextBuilderImpl(
       resourceProvider: this.resourceProvider,
     );
-    // While users can use the deprecated `updateAnalysisOptions2` and the new
-    // `updateAnalysisOptions3` parameter, prefer `updateAnalysisOptions3`, but
-    // create a new closure with the signature of the old.
-    var updateAnalysisOptions =
-        updateAnalysisOptions3 != null
-            ? ({
-              required AnalysisOptionsImpl analysisOptions,
-              required ContextRoot? contextRoot,
-              required DartSdk sdk,
-            }) => updateAnalysisOptions3(
-              analysisOptions: analysisOptions,
-              sdk: sdk,
-            )
-            : updateAnalysisOptions2;
+
     for (var root in roots) {
       var context = contextBuilder.createContext(
         byteStore: byteStore,
@@ -141,7 +113,7 @@
         sdkPath: sdkPath,
         sdkSummaryPath: sdkSummaryPath,
         scheduler: scheduler,
-        updateAnalysisOptions2: updateAnalysisOptions,
+        updateAnalysisOptions3: updateAnalysisOptions3,
         fileContentCache: fileContentCache,
         unlinkedUnitStore: unlinkedUnitStore ?? UnlinkedUnitStoreImpl(),
         infoDeclarationStore: infoDeclarationStore,
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
index 04c146d..3d1d6af 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart
@@ -81,10 +81,9 @@
     String? sdkSummaryPath,
     void Function({
       required AnalysisOptionsImpl analysisOptions,
-      required ContextRoot contextRoot,
       required DartSdk sdk,
     })?
-    updateAnalysisOptions2,
+    updateAnalysisOptions3,
     FileContentCache? fileContentCache,
     UnlinkedUnitStore? unlinkedUnitStore,
     InfoDeclarationStore? infoDeclarationStore,
@@ -137,7 +136,7 @@
           optionsFile,
           sourceFactory,
           sdk,
-          updateAnalysisOptions2,
+          updateAnalysisOptions3,
         ),
       );
     } else {
@@ -146,7 +145,7 @@
       analysisOptionsMap = _createOptionsMap(
         contextRoot,
         sourceFactory,
-        updateAnalysisOptions2,
+        updateAnalysisOptions3,
         sdk,
       );
     }
@@ -192,7 +191,6 @@
     SourceFactory sourceFactory,
     void Function({
       required AnalysisOptionsImpl analysisOptions,
-      required ContextRoot contextRoot,
       required DartSdk sdk,
     })?
     updateAnalysisOptions,
@@ -202,11 +200,7 @@
 
     void updateOptions(AnalysisOptionsImpl options) {
       if (updateAnalysisOptions != null) {
-        updateAnalysisOptions(
-          analysisOptions: options,
-          contextRoot: contextRoot,
-          sdk: sdk,
-        );
+        updateAnalysisOptions(analysisOptions: options, sdk: sdk);
       }
     }
 
@@ -291,7 +285,6 @@
     DartSdk sdk,
     void Function({
       required AnalysisOptionsImpl analysisOptions,
-      required ContextRoot contextRoot,
       required DartSdk sdk,
     })?
     updateAnalysisOptions,
@@ -313,11 +306,7 @@
     options ??= AnalysisOptionsImpl(file: optionsFile);
 
     if (updateAnalysisOptions != null) {
-      updateAnalysisOptions(
-        analysisOptions: options,
-        contextRoot: contextRoot,
-        sdk: sdk,
-      );
+      updateAnalysisOptions(analysisOptions: options, sdk: sdk);
     }
 
     return options;