Version 2.17.0-279.0.dev

Merge commit '4b322a398aeecfdf10636b1b757e70ed6400b6b3' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/error_token.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/error_token.dart
index 35b4652..824d170 100644
--- a/pkg/_fe_analyzer_shared/lib/src/scanner/error_token.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/scanner/error_token.dart
@@ -101,11 +101,6 @@
   int? get endOffset => null;
 
   BeginToken? get begin => null;
-
-  @override
-  Token copy() {
-    throw 'unsupported operation';
-  }
 }
 
 /// Represents an encoding error.
diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
index d4225fb..356601f 100644
--- a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart
@@ -55,9 +55,6 @@
   }
 
   @override
-  Token copy() => new BeginToken(type, offset, copyComments(precedingComments));
-
-  @override
   Token? get endGroup => endToken;
 
   /**
@@ -83,25 +80,6 @@
    */
   CommentToken(TokenType type, String value, int offset)
       : super(type, value, offset);
-
-  @override
-  CommentToken copy() => new CommentToken(type, _value, offset);
-
-  /**
-   * Remove this comment token from the list.
-   *
-   * This is used when we decide to interpret the comment as syntax.
-   */
-  void remove() {
-    Token? previous = this.previous;
-    if (previous != null) {
-      previous.setNextWithoutSettingPrevious(next);
-      next?.previous = previous;
-    } else {
-      assert(parent!.precedingComments == this);
-      parent!.precedingComments = next as CommentToken?;
-    }
-  }
 }
 
 /**
@@ -114,9 +92,6 @@
    */
   DocumentationCommentToken(TokenType type, String value, int offset)
       : super(type, value, offset);
-
-  @override
-  CommentToken copy() => new DocumentationCommentToken(type, _value, offset);
 }
 
 enum KeywordStyle {
@@ -482,10 +457,6 @@
       : super(keyword, offset, precedingComment);
 
   @override
-  Token copy() =>
-      new KeywordToken(keyword, offset, copyComments(precedingComments));
-
-  @override
   bool get isIdentifier => keyword.isPseudo || keyword.isBuiltIn;
 
   @override
@@ -515,10 +486,6 @@
 
   LanguageVersionToken.from(String text, int offset, this.major, this.minor)
       : super(TokenType.SINGLE_LINE_COMMENT, text, offset);
-
-  @override
-  LanguageVersionToken copy() =>
-      new LanguageVersionToken.from(lexeme, offset, major, minor);
 }
 
 /**
@@ -634,25 +601,6 @@
   String? get stringValue => type.stringValue;
 
   @override
-  Token copy() =>
-      new SimpleToken(type, offset, copyComments(precedingComments));
-
-  @override
-  CommentToken? copyComments(CommentToken? token) {
-    if (token == null) {
-      return null;
-    }
-    CommentToken head = token.copy();
-    Token tail = head;
-    token = token.next as CommentToken?;
-    while (token != null) {
-      tail = tail.setNext(token.copy());
-      token = token.next as CommentToken?;
-    }
-    return head;
-  }
-
-  @override
   bool matchesAny(List<TokenType> types) {
     for (TokenType type in types) {
       if (this.type == type) {
@@ -719,10 +667,6 @@
   String get lexeme => _value;
 
   @override
-  Token copy() =>
-      new StringToken(type, _value, offset, copyComments(precedingComments));
-
-  @override
   String value() => _value;
 }
 
@@ -742,10 +686,6 @@
   Token? beforeSynthetic;
 
   @override
-  Token copy() =>
-      new SyntheticBeginToken(type, offset, copyComments(precedingComments));
-
-  @override
   bool get isSynthetic => true;
 
   @override
@@ -767,9 +707,6 @@
 
   @override
   int get length => 0;
-
-  @override
-  Token copy() => new SyntheticKeywordToken(keyword, offset);
 }
 
 /**
@@ -794,9 +731,6 @@
 
   @override
   int get length => _length ?? super.length;
-
-  @override
-  Token copy() => new SyntheticStringToken(type, _value, offset, _length);
 }
 
 /**
@@ -813,9 +747,6 @@
 
   @override
   int get length => 0;
-
-  @override
-  Token copy() => new SyntheticToken(type, offset);
 }
 
 /// A token used to replace another token in the stream, while still keeping the
@@ -839,9 +770,6 @@
 
   @override
   int get length => 0;
-
-  @override
-  Token copy() => new ReplacementToken(type, replacedToken);
 }
 
 /**
@@ -1042,18 +970,6 @@
   TokenType get type;
 
   /**
-   * Return a newly created token that is a copy of this tokens
-   * including any [preceedingComment] tokens,
-   * but that is not a part of any token stream.
-   */
-  Token copy();
-
-  /**
-   * Copy a linked list of comment tokens identical to the given comment tokens.
-   */
-  CommentToken? copyComments(CommentToken? token);
-
-  /**
    * Return `true` if this token has any one of the given [types].
    */
   bool matchesAny(List<TokenType> types);
diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart
index 3c84db5..da39df5 100644
--- a/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart
@@ -5,7 +5,7 @@
 library _fe_analyzer_shared.scanner.token;
 
 import 'token.dart' as analyzer;
-import 'token.dart' show Token, TokenType;
+import 'token.dart' show TokenType;
 
 import 'token_constants.dart' show IDENTIFIER_TOKEN;
 
@@ -116,10 +116,6 @@
   }
 
   @override
-  Token copy() => new StringToken._(
-      type, valueOrLazySubstring, charOffset, copyComments(precedingComments));
-
-  @override
   String value() => lexeme;
 }
 
@@ -134,10 +130,6 @@
 
   @override
   int get length => 0;
-
-  @override
-  Token copy() => new SyntheticStringToken(
-      type, valueOrLazySubstring, offset, copyComments(precedingComments));
 }
 
 class CommentToken extends StringToken implements analyzer.CommentToken {
@@ -167,24 +159,6 @@
   CommentToken.fromUtf8Bytes(TokenType type, List<int> data, int start, int end,
       bool asciiOnly, int charOffset)
       : super.fromUtf8Bytes(type, data, start, end, asciiOnly, charOffset);
-
-  CommentToken._(TokenType type, valueOrLazySubstring, int charOffset)
-      : super._(type, valueOrLazySubstring, charOffset);
-
-  @override
-  CommentToken copy() =>
-      new CommentToken._(type, valueOrLazySubstring, charOffset);
-
-  @override
-  void remove() {
-    if (previous != null) {
-      previous!.setNextWithoutSettingPrevious(next);
-      next?.previous = previous;
-    } else {
-      assert(parent!.precedingComments == this);
-      parent!.precedingComments = next as CommentToken;
-    }
-  }
 }
 
 class LanguageVersionToken extends CommentToken
@@ -209,10 +183,6 @@
       int tokenStart, this.major, this.minor)
       : super.fromUtf8Bytes(
             TokenType.SINGLE_LINE_COMMENT, bytes, start, end, true, tokenStart);
-
-  @override
-  LanguageVersionToken copy() =>
-      new LanguageVersionToken.from(lexeme, offset, major, minor);
 }
 
 class DartDocToken extends CommentToken
@@ -234,13 +204,6 @@
   DartDocToken.fromUtf8Bytes(TokenType type, List<int> data, int start, int end,
       bool asciiOnly, int charOffset)
       : super.fromUtf8Bytes(type, data, start, end, asciiOnly, charOffset);
-
-  DartDocToken._(TokenType type, valueOrLazySubstring, int charOffset)
-      : super._(type, valueOrLazySubstring, charOffset);
-
-  @override
-  DartDocToken copy() =>
-      new DartDocToken._(type, valueOrLazySubstring, charOffset);
 }
 
 /**
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index 893de44..306c6e0 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -503,7 +503,7 @@
 
     try {
       await driver.applyPendingFileChanges();
-      return driver.resolveForCompletion(
+      return await driver.resolveForCompletion(
         path: path,
         offset: offset,
         performance: performance,
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
index 52e893e..f84c677 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
@@ -73,7 +73,7 @@
         continue;
       }
 
-      var element = analysisDriver.getLibraryByFile(file);
+      var element = await analysisDriver.getLibraryByFile(file);
       if (element == null || importedLibraries.contains(element)) {
         continue;
       }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart b/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart
index b613ec7..54b4d6b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart
@@ -36,7 +36,7 @@
         continue;
       }
 
-      var libraryElement = analysisDriver.getLibraryByFile(file);
+      var libraryElement = await analysisDriver.getLibraryByFile(file);
       if (libraryElement == null) {
         continue;
       }
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/dart/top_level_declarations.dart b/pkg/analysis_server/lib/src/services/correction/fix/dart/top_level_declarations.dart
index 0106ff1..7d66ece 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/dart/top_level_declarations.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/dart/top_level_declarations.dart
@@ -39,7 +39,7 @@
         continue;
       }
 
-      var libraryElement = analysisDriver.getLibraryByFile(file);
+      var libraryElement = await analysisDriver.getLibraryByFile(file);
       if (libraryElement == null) {
         continue;
       }
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index af3475f..5ff3292 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,26 @@
+## 4.0.0 (Not yet released - breaking changes)
+* Removed deprecated `UriKind` and `Source.uriKind`.
+* Removed deprecated `LibraryElement.hasExtUri`.
+* Removed deprecated `LibraryElement.hasLoadLibraryFunction`.
+* Removed deprecated `ImportElement.prefixOffset`.
+* Removed deprecated `CompilationUnitElement.types`.
+* Removed deprecated `Source.encoding`.
+* Removed deprecated `Source.isInSystemLibrary`.
+* Removed deprecated `Source.modificationStamp`.
+* Removed deprecated `stamp` in `MemoryResourceProvider`.
+* Removed deprecated `SourceFactory.restoreUri`, use `pathToUri` instead.
+* Removed deprecated `AnalysisContext.workspace`.
+* The `isNonNullableByDefault` parameter in `ErrorReporter` is now required.
+* Removed `Element.SORT_BY_OFFSET`, it is not used.
+* Changed synchronous `AnalysisSession.getFile` and `getParsedUnit` to fail
+  if there are pending file changes, instead of reading. As for any other
+  `AnalysisSession` method, await `AnalysisContext.applyPendingFileChanges()`.
+* Removed `Token.copy()` and `copyComments()`.
+* Removed `CommentToken.remove()`.
+* Removed deprecated `astFactory` and `AstFactory`.
+* Removed `AnalysisOptions.signature` and `signaturesEqual`.
+* Removed deprecated `buildSdkSummary()`.
+
 ## 3.4.1
 * Remove checks for consistency after operations in `AnalysisSession`.
 
diff --git a/pkg/analyzer/lib/dart/analysis/analysis_context.dart b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
index 4003c68..e43c300 100644
--- a/pkg/analyzer/lib/dart/analysis/analysis_context.dart
+++ b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
@@ -6,7 +6,6 @@
 import 'package:analyzer/dart/analysis/session.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/workspace/workspace.dart';
 
 /// A representation of a body of code and the context in which the code is to
 /// be analyzed.
@@ -32,10 +31,6 @@
   /// analyzed, or `null` if the SDK is not directory based.
   Folder? get sdkRoot;
 
-  /// Return the workspace for containing the context root.
-  @Deprecated('Use contextRoot.workspace instead')
-  Workspace get workspace;
-
   /// Return a [Future] that completes after pending file changes are applied,
   /// so that [currentSession] can be used to compute results.
   ///
diff --git a/pkg/analyzer/lib/dart/analysis/analysis_options.dart b/pkg/analyzer/lib/dart/analysis/analysis_options.dart
index fbb185e..05fbbaf 100644
--- a/pkg/analyzer/lib/dart/analysis/analysis_options.dart
+++ b/pkg/analyzer/lib/dart/analysis/analysis_options.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'dart:typed_data';
-
 import 'package:analyzer/dart/analysis/code_style_options.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/source/error_processor.dart';
@@ -52,22 +50,6 @@
   /// there is no `pubspec.yaml` or if it does not contain an SDK range.
   VersionConstraint? get sdkVersionConstraint;
 
-  /// Return the opaque signature of the options.
-  Uint32List get signature;
-
   /// Return `true` the lint with the given [name] is enabled.
   bool isLintEnabled(String name);
-
-  /// Determine whether two signatures returned by [signature] are equal.
-  static bool signaturesEqual(Uint32List a, Uint32List b) {
-    if (a.length != b.length) {
-      return false;
-    }
-    for (int i = 0; i < a.length; i++) {
-      if (a[i] != b[i]) {
-        return false;
-      }
-    }
-    return true;
-  }
 }
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
deleted file mode 100644
index dfba96d..0000000
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ /dev/null
@@ -1,1045 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:_fe_analyzer_shared/src/scanner/token.dart';
-import 'package:analyzer/dart/analysis/features.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/source/line_info.dart';
-import 'package:analyzer/src/generated/utilities_dart.dart';
-
-/// A collection of factory methods which may be used to create concrete
-/// instances of the interfaces that constitute the AST.
-///
-/// Clients should not extend, implement or mix-in this class.
-@Deprecated('Should not be used by clients')
-abstract class AstFactory {
-  /// Returns a newly created list of adjacent strings. To be syntactically
-  /// valid, the list of [strings] must contain at least two elements.
-  AdjacentStrings adjacentStrings(List<StringLiteral> strings);
-
-  /// Returns a newly created annotation. Both the [period] and the
-  /// [constructorName] can be `null` if the annotation is not referencing a
-  /// named constructor. The [arguments] can be `null` if the annotation is not
-  /// referencing a constructor.
-  ///
-  /// Note that type arguments are only valid if [Feature.generic_metadata] is
-  /// enabled.
-  Annotation annotation(
-      {required Token atSign,
-      required Identifier name,
-      TypeArgumentList? typeArguments,
-      Token? period,
-      SimpleIdentifier? constructorName,
-      ArgumentList? arguments});
-
-  /// Returns a newly created list of arguments. The list of [arguments] can
-  /// be `null` if there are no arguments.
-  ArgumentList argumentList(Token leftParenthesis, List<Expression> arguments,
-      Token rightParenthesis);
-
-  /// Returns a newly created as expression.
-  AsExpression asExpression(
-      Expression expression, Token asOperator, TypeAnnotation type);
-
-  /// Returns a newly created assert initializer. The [comma] and [message]
-  /// can be `null` if there is no message.
-  AssertInitializer assertInitializer(
-      Token assertKeyword,
-      Token leftParenthesis,
-      Expression condition,
-      Token? comma,
-      Expression? message,
-      Token rightParenthesis);
-
-  /// Returns a newly created assert statement. The [comma] and [message] can
-  /// be `null` if there is no message.
-  AssertStatement assertStatement(
-      Token assertKeyword,
-      Token leftParenthesis,
-      Expression condition,
-      Token? comma,
-      Expression? message,
-      Token rightParenthesis,
-      Token semicolon);
-
-  /// Returns a newly created assignment expression.
-  AssignmentExpression assignmentExpression(
-      Expression leftHandSide, Token operator, Expression rightHandSide);
-
-  /// Returns a newly created await expression.
-  AwaitExpression awaitExpression(Token awaitKeyword, Expression expression);
-
-  /// Returns a newly created binary expression.
-  BinaryExpression binaryExpression(
-      Expression leftOperand, Token operator, Expression rightOperand);
-
-  /// Returns a newly created block of code.
-  Block block(
-      Token leftBracket, List<Statement> statements, Token rightBracket);
-
-  /// Returns a block comment consisting of the given [tokens].
-  Comment blockComment(List<Token> tokens);
-
-  /// Returns a newly created function body consisting of a block of
-  /// statements. The [keyword] can be `null` if there is no keyword specified
-  /// for the block. The [star] can be `null` if there is no star following the
-  /// keyword (and must be `null` if there is no keyword).
-  BlockFunctionBody blockFunctionBody(Token? keyword, Token? star, Block block);
-
-  /// Returns a newly created boolean literal.
-  BooleanLiteral booleanLiteral(Token literal, bool value);
-
-  /// Returns a newly created break statement. The [label] can be `null` if
-  /// there is no label associated with the statement.
-  BreakStatement breakStatement(
-      Token breakKeyword, SimpleIdentifier? label, Token semicolon);
-
-  /// Returns a newly created cascade expression. The list of
-  /// [cascadeSections] must contain at least one element.
-  CascadeExpression cascadeExpression(
-      Expression target, List<Expression> cascadeSections);
-
-  /// Returns a newly created catch clause. The [onKeyword] and [exceptionType]
-  /// can be `null` if the clause will catch all exceptions. The [comma] and
-  /// [stackTraceParameter] can be `null` if the stack trace parameter is not
-  /// defined.
-  CatchClause catchClause(
-      Token? onKeyword,
-      TypeAnnotation? exceptionType,
-      Token? catchKeyword,
-      Token? leftParenthesis,
-      SimpleIdentifier? exceptionParameter,
-      Token? comma,
-      SimpleIdentifier? stackTraceParameter,
-      Token? rightParenthesis,
-      Block body);
-
-  /// Returns a newly created class declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the class does not have the
-  /// corresponding attribute. The [abstractKeyword] can be `null` if the class
-  /// is not abstract. The [macroKeyword] can be `null` if the class is not a
-  /// macro class. The [augmentKeyword] can be `null` if the class is not an
-  /// augmentation class. The [typeParameters] can be `null` if the class does
-  /// not have any type parameters. Any or all of the [extendsClause],
-  /// [withClause], and [implementsClause] can be `null` if the class does not
-  /// have the corresponding clause. The list of [members] can be `null` if the
-  /// class does not have any members.
-  ClassDeclaration classDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? abstractKeyword,
-      Token? macroKeyword,
-      Token? augmentKeyword,
-      Token classKeyword,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      ExtendsClause? extendsClause,
-      WithClause? withClause,
-      ImplementsClause? implementsClause,
-      Token leftBracket,
-      List<ClassMember> members,
-      Token rightBracket);
-
-  /// Returns a newly created class type alias. Either or both of the [comment]
-  /// and [metadata] can be `null` if the class type alias does not have the
-  /// corresponding attribute. The [typeParameters] can be `null` if the class
-  /// does not have any type parameters. The [abstractKeyword] can be `null` if
-  /// the class is not abstract. The [macroKeyword] can be `null` if the class
-  /// is not a macro class. The [augmentKeyword] can be `null` if the class is
-  /// not an augmentation class.  The [implementsClause] can be `null` if the
-  /// class does not implement any interfaces.
-  ClassTypeAlias classTypeAlias(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token keyword,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      Token equals,
-      Token? abstractKeyword,
-      Token? macroKeyword,
-      Token? augmentKeyword,
-      NamedType superclass,
-      WithClause withClause,
-      ImplementsClause? implementsClause,
-      Token semicolon);
-
-  /// Returns a newly created reference to a Dart element. The [newKeyword]
-  /// can be `null` if the reference is not to a constructor.
-  CommentReference commentReference(
-      Token? newKeyword, CommentReferableExpression expression);
-
-  /// Returns a newly created compilation unit to have the given directives and
-  /// declarations.  The [scriptTag] can be `null` (or omitted) if there is no
-  /// script tag in the compilation unit.  The list of [declarations] can be
-  /// `null` (or omitted) if there are no directives in the compilation unit.
-  /// The list of `declarations` can be `null` (or omitted) if there are no
-  /// declarations in the compilation unit.
-  CompilationUnit compilationUnit({
-    required Token beginToken,
-    ScriptTag? scriptTag,
-    List<Directive>? directives,
-    List<CompilationUnitMember>? declarations,
-    required Token endToken,
-    required FeatureSet featureSet,
-    LineInfo? lineInfo,
-  });
-
-  /// Returns a newly created conditional expression.
-  ConditionalExpression conditionalExpression(
-      Expression condition,
-      Token question,
-      Expression thenExpression,
-      Token colon,
-      Expression elseExpression);
-
-  /// Returns a newly created configuration.
-  Configuration configuration(
-      Token ifKeyword,
-      Token leftParenthesis,
-      DottedName name,
-      Token? equalToken,
-      StringLiteral? value,
-      Token rightParenthesis,
-      StringLiteral libraryUri);
-
-  /// Returns a newly created constructor declaration. The [externalKeyword]
-  /// can be `null` if the constructor is not external. Either or both of the
-  /// [comment] and [metadata] can be `null` if the constructor does not have
-  /// the corresponding attribute. The [constKeyword] can be `null` if the
-  /// constructor cannot be used to create a constant. The [factoryKeyword] can
-  /// be `null` if the constructor is not a factory. The [period] and [name] can
-  /// both be `null` if the constructor is not a named constructor. The
-  /// [separator] can be `null` if the constructor does not have any
-  /// initializers and does not redirect to a different constructor. The list of
-  /// [initializers] can be `null` if the constructor does not have any
-  /// initializers. The [redirectedConstructor] can be `null` if the constructor
-  /// does not redirect to a different constructor.
-  ConstructorDeclaration constructorDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? externalKeyword,
-      Token? constKeyword,
-      Token? factoryKeyword,
-      Identifier returnType,
-      Token? period,
-      SimpleIdentifier? name,
-      FormalParameterList parameters,
-      Token? separator,
-      List<ConstructorInitializer>? initializers,
-      ConstructorName? redirectedConstructor,
-      FunctionBody body);
-
-  /// Returns a newly created field initializer to initialize the field with
-  /// the given name to the value of the given expression. The [thisKeyword] and
-  /// [period] can be `null` if the 'this' keyword was not specified.
-  ConstructorFieldInitializer constructorFieldInitializer(
-      Token? thisKeyword,
-      Token? period,
-      SimpleIdentifier fieldName,
-      Token equals,
-      Expression expression);
-
-  /// Returns a newly created constructor name. The [period] and [name] can be
-  /// `null` if the constructor being named is the unnamed constructor.
-  ConstructorName constructorName(
-      NamedType type, Token? period, SimpleIdentifier? name);
-
-  /// Returns a newly created constructor reference.
-  ConstructorReference constructorReference(
-      {required ConstructorName constructorName});
-
-  /// Returns a newly created continue statement. The [label] can be `null` if
-  /// there is no label associated with the statement.
-  ContinueStatement continueStatement(
-      Token continueKeyword, SimpleIdentifier? label, Token semicolon);
-
-  /// Returns a newly created formal parameter. Either or both of the
-  /// [comment] and [metadata] can be `null` if the declaration does not have
-  /// the corresponding attribute. The [keyword] can be `null` if a type name is
-  /// given. The [type] must be `null` if the keyword is 'var'.
-  DeclaredIdentifier declaredIdentifier(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? keyword,
-      TypeAnnotation? type,
-      SimpleIdentifier identifier);
-
-  /// Returns a newly created default formal parameter. The [separator] and
-  /// [defaultValue] can be `null` if there is no default value.
-  DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter,
-      ParameterKind kind, Token? separator, Expression? defaultValue);
-
-  /// Returns a documentation comment consisting of the given [tokens] and
-  /// having the given [references] (if supplied) embedded within it.
-  Comment documentationComment(List<Token> tokens,
-      [List<CommentReference> references]);
-
-  /// Returns a newly created do loop.
-  DoStatement doStatement(
-      Token doKeyword,
-      Statement body,
-      Token whileKeyword,
-      Token leftParenthesis,
-      Expression condition,
-      Token rightParenthesis,
-      Token semicolon);
-
-  /// Returns a newly created dotted name.
-  DottedName dottedName(List<SimpleIdentifier> components);
-
-  /// Returns a newly created floating point literal.
-  DoubleLiteral doubleLiteral(Token literal, double value);
-
-  /// Returns a newly created function body.
-  EmptyFunctionBody emptyFunctionBody(Token semicolon);
-
-  /// Returns a newly created empty statement.
-  EmptyStatement emptyStatement(Token semicolon);
-
-  /// Returns an end-of-line comment consisting of the given [tokens].
-  Comment endOfLineComment(List<Token> tokens);
-
-  /// Returns a newly created enum constant declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the constant does not have the
-  /// corresponding attribute. (Technically, enum constants cannot have
-  /// metadata, but we allow it for consistency.)
-  EnumConstantDeclaration enumConstantDeclaration(
-      Comment? comment, List<Annotation>? metadata, SimpleIdentifier name);
-
-  /// Returns a newly created enumeration declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the declaration does not have
-  /// the corresponding attribute. The list of [constants] must contain at least
-  /// one value.
-  @Deprecated('Use enumDeclaration2() instead')
-  EnumDeclaration enumDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token enumKeyword,
-      SimpleIdentifier name,
-      Token leftBracket,
-      List<EnumConstantDeclaration> constants,
-      Token rightBracket);
-
-  /// Returns a newly created enumeration declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the declaration does not have
-  /// the corresponding attribute. The list of [constants] must contain at least
-  /// one value.
-  EnumDeclaration enumDeclaration2({
-    required Comment? comment,
-    required List<Annotation>? metadata,
-    required Token enumKeyword,
-    required SimpleIdentifier name,
-    required TypeParameterList? typeParameters,
-    required WithClause? withClause,
-    required ImplementsClause? implementsClause,
-    required Token leftBracket,
-    required List<EnumConstantDeclaration> constants,
-    required Token? semicolon,
-    required List<ClassMember> members,
-    required Token rightBracket,
-  });
-
-  /// Returns a newly created export directive. Either or both of the
-  /// [comment] and [metadata] can be `null` if the directive does not have the
-  /// corresponding attribute. The list of [combinators] can be `null` if there
-  /// are no combinators.
-  ExportDirective exportDirective(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token keyword,
-      StringLiteral libraryUri,
-      List<Configuration>? configurations,
-      List<Combinator>? combinators,
-      Token semicolon);
-
-  /// Returns a newly created function body consisting of an expression.
-  /// The [keyword] can be `null` if the function body is not an async function
-  /// body.
-  @Deprecated("Use expressionFunctionBody2, with new 'star' parameter")
-  ExpressionFunctionBody expressionFunctionBody(Token? keyword,
-      Token functionDefinition, Expression expression, Token? semicolon);
-
-  /// Returns a newly created function body consisting of an expression.
-  /// The [keyword] can be `null` if the function body is not an async function
-  /// body. The [star] can be `null` if there is no star following the keyword
-  /// (and must be `null` if there is no keyword).
-  ExpressionFunctionBody expressionFunctionBody2({
-    Token? keyword,
-    Token? star,
-    required Token functionDefinition,
-    required Expression expression,
-    Token? semicolon,
-  });
-
-  /// Returns a newly created expression statement.
-  ExpressionStatement expressionStatement(
-      Expression expression, Token? semicolon);
-
-  /// Returns a newly created extends clause.
-  ExtendsClause extendsClause(Token extendsKeyword, NamedType superclass);
-
-  /// Return a newly created extension declaration. The list of [typeParameters]
-  /// can be `null` if there are no type parameters.
-  ExtensionDeclaration extensionDeclaration(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      required Token extensionKeyword,
-      Token? typeKeyword,
-      SimpleIdentifier? name,
-      TypeParameterList? typeParameters,
-      required Token onKeyword,
-      required TypeAnnotation extendedType,
-      required Token leftBracket,
-      required List<ClassMember> members,
-      required Token rightBracket});
-
-  /// Return a newly created extension override. The list of [typeArguments]
-  /// can be `null` if there are no type arguments.
-  ExtensionOverride extensionOverride(
-      {required Identifier extensionName,
-      TypeArgumentList? typeArguments,
-      required ArgumentList argumentList});
-
-  /// Returns a newly created field declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the declaration does not have
-  /// the corresponding attribute. The [abstractKeyword], [augmentKeyword],
-  /// [covariantKeyword], [externalKeyword] and [staticKeyword] can be `null` if
-  /// the field does not have the corresponding modifier.
-  FieldDeclaration fieldDeclaration2(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? abstractKeyword,
-      Token? augmentKeyword,
-      Token? covariantKeyword,
-      Token? externalKeyword,
-      Token? staticKeyword,
-      required VariableDeclarationList fieldList,
-      required Token semicolon});
-
-  /// Returns a newly created formal parameter. Either or both of the [comment]
-  /// and [metadata] can be `null` if the parameter does not have the
-  /// corresponding attribute. The [keyword] can be `null` if there is a type.
-  /// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
-  /// [period] can be `null` if the keyword 'this' was not provided.  The
-  /// [parameters] can be `null` if this is not a function-typed field formal
-  /// parameter.
-  FieldFormalParameter fieldFormalParameter2(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? covariantKeyword,
-      Token? requiredKeyword,
-      Token? keyword,
-      TypeAnnotation? type,
-      required Token thisKeyword,
-      required Token period,
-      required SimpleIdentifier identifier,
-      TypeParameterList? typeParameters,
-      FormalParameterList? parameters,
-      Token? question});
-
-  /// Returns a newly created for each part that includes a declaration.
-  ForEachPartsWithDeclaration forEachPartsWithDeclaration(
-      {required DeclaredIdentifier loopVariable,
-      required Token inKeyword,
-      required Expression iterable});
-
-  /// Returns a newly created for each part that includes an identifier that is
-  /// declared outside of the loop.
-  ForEachPartsWithIdentifier forEachPartsWithIdentifier(
-      {required SimpleIdentifier identifier,
-      required Token inKeyword,
-      required Expression iterable});
-
-  /// Returns a newly created for element that can be part of a list, map or set
-  /// literal.
-  ForElement forElement(
-      {Token? awaitKeyword,
-      required Token forKeyword,
-      required Token leftParenthesis,
-      required ForLoopParts forLoopParts,
-      required Token rightParenthesis,
-      required CollectionElement body});
-
-  /// Returns a newly created parameter list. The list of [parameters] can be
-  /// `null` if there are no parameters. The [leftDelimiter] and
-  /// [rightDelimiter] can be `null` if there are no optional parameters.
-  FormalParameterList formalParameterList(
-      Token leftParenthesis,
-      List<FormalParameter> parameters,
-      Token? leftDelimiter,
-      Token? rightDelimiter,
-      Token rightParenthesis);
-
-  /// Returns a newly created for part that includes a declaration.
-  ForPartsWithDeclarations forPartsWithDeclarations(
-      {required VariableDeclarationList variables,
-      required Token leftSeparator,
-      Expression? condition,
-      required Token rightSeparator,
-      List<Expression>? updaters});
-
-  /// Returns a newly created for part that includes an expression.
-  ForPartsWithExpression forPartsWithExpression(
-      {Expression? initialization,
-      required Token leftSeparator,
-      Expression? condition,
-      required Token rightSeparator,
-      List<Expression>? updaters});
-
-  /// Returns a newly created for statement.
-  ForStatement forStatement(
-      {Token? awaitKeyword,
-      required Token forKeyword,
-      required Token leftParenthesis,
-      required ForLoopParts forLoopParts,
-      required Token rightParenthesis,
-      required Statement body});
-
-  /// Returns a newly created function declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the function does not have the
-  /// corresponding attribute. The [augmentKeyword] can be `null` if the
-  /// function is not a function augmentation. The [externalKeyword] can be
-  /// `null` if the function is not an external function. The [returnType] can
-  /// be `null` if no return type was specified. The [propertyKeyword] can be
-  /// `null` if the function is neither a getter or a setter.
-  FunctionDeclaration functionDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? augmentKeyword,
-      Token? externalKeyword,
-      TypeAnnotation? returnType,
-      Token? propertyKeyword,
-      SimpleIdentifier name,
-      FunctionExpression functionExpression);
-
-  /// Returns a newly created function declaration statement.
-  FunctionDeclarationStatement functionDeclarationStatement(
-      FunctionDeclaration functionDeclaration);
-
-  /// Returns a newly created function declaration.
-  FunctionExpression functionExpression(TypeParameterList? typeParameters,
-      FormalParameterList? parameters, FunctionBody body);
-
-  /// Returns a newly created function expression invocation.
-  FunctionExpressionInvocation functionExpressionInvocation(Expression function,
-      TypeArgumentList? typeArguments, ArgumentList argumentList);
-
-  /// Returns a newly created function reference.  The [typeArguments] can be
-  /// `null` if there are no type arguments being applied to the function.
-  FunctionReference functionReference(
-      {required Expression function, TypeArgumentList? typeArguments});
-
-  /// Returns a newly created function type alias. Either or both of the
-  /// [comment] and [metadata] can be `null` if the function does not have the
-  /// corresponding attribute. The [returnType] can be `null` if no return type
-  /// was specified. The [typeParameters] can be `null` if the function has no
-  /// type parameters.
-  FunctionTypeAlias functionTypeAlias(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token keyword,
-      TypeAnnotation? returnType,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      FormalParameterList parameters,
-      Token semicolon);
-
-  /// Returns a newly created formal parameter. Either or both of the
-  /// [comment] and [metadata] can be `null` if the parameter does not have the
-  /// corresponding attribute. The [returnType] can be `null` if no return type
-  /// was specified.
-  FunctionTypedFormalParameter functionTypedFormalParameter2(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? covariantKeyword,
-      Token? requiredKeyword,
-      TypeAnnotation? returnType,
-      required SimpleIdentifier identifier,
-      TypeParameterList? typeParameters,
-      required FormalParameterList parameters,
-      Token? question});
-
-  /// Initialize a newly created generic function type.
-  GenericFunctionType genericFunctionType(
-      TypeAnnotation? returnType,
-      Token functionKeyword,
-      TypeParameterList? typeParameters,
-      FormalParameterList parameters,
-      {Token? question});
-
-  /// Returns a newly created generic type alias. Either or both of the
-  /// [comment] and [metadata] can be `null` if the variable list does not have
-  /// the corresponding attribute. The [typeParameters] can be `null` if there
-  /// are no type parameters.
-  GenericTypeAlias genericTypeAlias(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token typedefKeyword,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      Token equals,
-      TypeAnnotation type,
-      Token semicolon);
-
-  /// Returns a newly created hide clause.
-  HideClause hideClause(
-      {required Token hideKeyword,
-      required List<ShowHideClauseElement> elements});
-
-  /// Returns a newly created import show combinator.
-  HideCombinator hideCombinator(
-      Token keyword, List<SimpleIdentifier> hiddenNames);
-
-  /// Returns a newly created if element that can be part of a list, map or set
-  /// literal.
-  IfElement ifElement(
-      {required Token ifKeyword,
-      required Token leftParenthesis,
-      required Expression condition,
-      required Token rightParenthesis,
-      required CollectionElement thenElement,
-      Token? elseKeyword,
-      CollectionElement? elseElement});
-
-  /// Returns a newly created if statement. The [elseKeyword] and
-  /// [elseStatement] can be `null` if there is no else clause.
-  IfStatement ifStatement(
-      Token ifKeyword,
-      Token leftParenthesis,
-      Expression condition,
-      Token rightParenthesis,
-      Statement thenStatement,
-      Token? elseKeyword,
-      Statement? elseStatement);
-
-  /// Returns a newly created implements clause.
-  ImplementsClause implementsClause(
-      Token implementsKeyword, List<NamedType> interfaces);
-
-  /// Returns a newly created implicit call reference.
-  ///
-  /// The [typeArguments] can be `null` if there are no type arguments being
-  /// applied to the reference.
-  ImplicitCallReference implicitCallReference({
-    required Expression expression,
-    required MethodElement staticElement,
-    required TypeArgumentList? typeArguments,
-    required List<DartType> typeArgumentTypes,
-  });
-
-  /// Returns a newly created import directive. Either or both of the [comment]
-  /// and [metadata] can be `null` if the function does not have the
-  /// corresponding attribute. The [deferredKeyword] can be `null` if the import
-  /// is not deferred. The [asKeyword] and [prefix] can be `null` if the import
-  /// does not specify a prefix. The list of [combinators] can be `null` if
-  /// there are no combinators.
-  ImportDirective importDirective(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token keyword,
-      StringLiteral libraryUri,
-      List<Configuration>? configurations,
-      Token? deferredKeyword,
-      Token? asKeyword,
-      SimpleIdentifier? prefix,
-      List<Combinator>? combinators,
-      Token semicolon);
-
-  /// Returns a newly created index expression.
-  IndexExpression indexExpressionForCascade2(
-      {required Token period,
-      Token? question,
-      required Token leftBracket,
-      required Expression index,
-      required Token rightBracket});
-
-  /// Returns a newly created index expression.
-  IndexExpression indexExpressionForTarget2(
-      {required Expression target,
-      Token? question,
-      required Token leftBracket,
-      required Expression index,
-      required Token rightBracket});
-
-  /// Returns a newly created instance creation expression.
-  InstanceCreationExpression instanceCreationExpression(Token? keyword,
-      ConstructorName constructorName, ArgumentList argumentList,
-      {TypeArgumentList? typeArguments});
-
-  /// Returns a newly created integer literal.
-  IntegerLiteral integerLiteral(Token literal, int? value);
-
-  /// Returns a newly created interpolation expression.
-  InterpolationExpression interpolationExpression(
-      Token leftBracket, Expression expression, Token? rightBracket);
-
-  /// Returns a newly created string of characters that are part of a string
-  /// interpolation.
-  InterpolationString interpolationString(Token contents, String value);
-
-  /// Returns a newly created is expression. The [notOperator] can be `null`
-  /// if the sense of the test is not negated.
-  IsExpression isExpression(Expression expression, Token isOperator,
-      Token? notOperator, TypeAnnotation type);
-
-  /// Returns a newly created label.
-  Label label(SimpleIdentifier label, Token colon);
-
-  /// Returns a newly created labeled statement.
-  LabeledStatement labeledStatement(List<Label> labels, Statement statement);
-
-  /// Returns a newly created library directive. Either or both of the
-  /// [comment] and [metadata] can be `null` if the directive does not have the
-  /// corresponding attribute.
-  LibraryDirective libraryDirective(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token libraryKeyword,
-      LibraryIdentifier name,
-      Token semicolon);
-
-  /// Returns a newly created prefixed identifier.
-  LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components);
-
-  /// Returns a newly created list literal. The [constKeyword] can be `null`
-  /// if the literal is not a constant. The [typeArguments] can be `null` if no
-  /// type arguments were declared. The list of [elements] can be `null` if the
-  /// list is empty.
-  ListLiteral listLiteral(Token? constKeyword, TypeArgumentList? typeArguments,
-      Token leftBracket, List<CollectionElement> elements, Token rightBracket);
-
-  /// Returns a newly created map literal entry.
-  MapLiteralEntry mapLiteralEntry(
-      Expression key, Token separator, Expression value);
-
-  /// Returns a newly created method declaration. Either or both of the
-  /// [comment] and [metadata] can be `null` if the declaration does not have
-  /// the corresponding attribute. The [externalKeyword] can be `null` if the
-  /// method is not external. The [modifierKeyword] can be `null` if the method
-  /// is neither abstract nor static. The [returnType] can be `null` if no
-  /// return type was specified. The [propertyKeyword] can be `null` if the
-  /// method is neither a getter or a setter. The [operatorKeyword] can be
-  /// `null` if the method does not implement an operator. The [parameters] must
-  /// be `null` if this method declares a getter.
-  MethodDeclaration methodDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? externalKeyword,
-      Token? modifierKeyword,
-      TypeAnnotation? returnType,
-      Token? propertyKeyword,
-      Token? operatorKeyword,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      FormalParameterList? parameters,
-      FunctionBody body);
-
-  /// Returns a newly created method invocation. The [target] and [operator]
-  /// can be `null` if there is no target.
-  MethodInvocation methodInvocation(
-      Expression? target,
-      Token? operator,
-      SimpleIdentifier methodName,
-      TypeArgumentList? typeArguments,
-      ArgumentList argumentList);
-
-  /// Return a newly created mixin declaration.
-  MixinDeclaration mixinDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? augmentKeyword,
-      Token mixinKeyword,
-      SimpleIdentifier name,
-      TypeParameterList? typeParameters,
-      OnClause? onClause,
-      ImplementsClause? implementsClause,
-      Token leftBracket,
-      List<ClassMember> members,
-      Token rightBracket);
-
-  /// Returns a newly created named expression.
-  NamedExpression namedExpression(Label name, Expression expression);
-
-  /// Returns a newly created named type. The [typeArguments] can be `null` if
-  /// there are no type arguments. The [question] can be `null` if there is no
-  /// question mark.
-  NamedType namedType({
-    required Identifier name,
-    TypeArgumentList? typeArguments,
-    Token? question,
-  });
-
-  /// Returns a newly created native clause.
-  NativeClause nativeClause(Token nativeKeyword, StringLiteral? name);
-
-  /// Returns a newly created function body consisting of the 'native' token,
-  /// a string literal, and a semicolon.
-  NativeFunctionBody nativeFunctionBody(
-      Token nativeKeyword, StringLiteral? stringLiteral, Token semicolon);
-
-  /// Returns a newly created list of nodes such that all of the nodes that
-  /// are added to the list will have their parent set to the given [owner].
-  NodeList<E> nodeList<E extends AstNode>(AstNode owner);
-
-  /// Returns a newly created null literal.
-  NullLiteral nullLiteral(Token literal);
-
-  /// Return a newly created on clause.
-  OnClause onClause(Token onKeyword, List<NamedType> superclassConstraints);
-
-  /// Returns a newly created parenthesized expression.
-  ParenthesizedExpression parenthesizedExpression(
-      Token leftParenthesis, Expression expression, Token rightParenthesis);
-
-  /// Returns a newly created part directive. Either or both of the [comment]
-  /// and [metadata] can be `null` if the directive does not have the
-  /// corresponding attribute.
-  PartDirective partDirective(Comment? comment, List<Annotation>? metadata,
-      Token partKeyword, StringLiteral partUri, Token semicolon);
-
-  /// Returns a newly created part-of directive. Either or both of the
-  /// [comment] and [metadata] can be `null` if the directive does not have the
-  /// corresponding attribute.
-  PartOfDirective partOfDirective(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token partKeyword,
-      Token ofKeyword,
-      StringLiteral? uri,
-      LibraryIdentifier? libraryName,
-      Token semicolon);
-
-  /// Returns a newly created postfix expression.
-  PostfixExpression postfixExpression(Expression operand, Token operator);
-
-  /// Returns a newly created prefixed identifier.
-  PrefixedIdentifier prefixedIdentifier(
-      SimpleIdentifier prefix, Token period, SimpleIdentifier identifier);
-
-  /// Returns a newly created prefix expression.
-  PrefixExpression prefixExpression(Token operator, Expression operand);
-
-  /// Returns a newly created property access expression.
-  PropertyAccess propertyAccess(
-      Expression? target, Token operator, SimpleIdentifier propertyName);
-
-  /// Returns a newly created redirecting invocation to invoke the constructor
-  /// with the given name with the given arguments. The [constructorName] can be
-  /// `null` if the constructor being invoked is the unnamed constructor.
-  RedirectingConstructorInvocation redirectingConstructorInvocation(
-      Token thisKeyword,
-      Token? period,
-      SimpleIdentifier? constructorName,
-      ArgumentList argumentList);
-
-  /// Returns a newly created rethrow expression.
-  RethrowExpression rethrowExpression(Token rethrowKeyword);
-
-  /// Returns a newly created return statement. The [expression] can be `null`
-  /// if no explicit value was provided.
-  ReturnStatement returnStatement(
-      Token returnKeyword, Expression? expression, Token semicolon);
-
-  /// Returns a newly created script tag.
-  ScriptTag scriptTag(Token scriptTag);
-
-  /// Returns a newly created set or map literal. The [constKeyword] can be
-  /// `null` if the literal is not a constant. The [typeArguments] can be `null`
-  /// if no type arguments were declared. The list of [elements] can be `null`
-  /// if the set or map is empty.
-  SetOrMapLiteral setOrMapLiteral(
-      {Token? constKeyword,
-      TypeArgumentList? typeArguments,
-      required Token leftBracket,
-      required List<CollectionElement> elements,
-      required Token rightBracket});
-
-  /// Returns a newly created show clause.
-  ShowClause showClause(
-      {required Token showKeyword,
-      required List<ShowHideClauseElement> elements});
-
-  /// Returns a newly created import show combinator.
-  ShowCombinator showCombinator(
-      Token keyword, List<SimpleIdentifier> shownNames);
-
-  /// Returns a newly created element of a show or hide clause.
-  ShowHideElement showHideElement(
-      {required Token? modifier, required SimpleIdentifier name});
-
-  /// Returns a newly created formal parameter. Either or both of the
-  /// [comment] and [metadata] can be `null` if the parameter does not have the
-  /// corresponding attribute. The [keyword] can be `null` if a type was
-  /// specified. The [type] must be `null` if the keyword is 'var'.
-  SimpleFormalParameter simpleFormalParameter2(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? covariantKeyword,
-      Token? requiredKeyword,
-      Token? keyword,
-      TypeAnnotation? type,
-      required SimpleIdentifier? identifier});
-
-  /// Returns a newly created identifier.
-  SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration = false});
-
-  /// Returns a newly created simple string literal.
-  SimpleStringLiteral simpleStringLiteral(Token literal, String value);
-
-  /// Returns a newly created spread element.
-  SpreadElement spreadElement(
-      {required Token spreadOperator, required Expression expression});
-
-  /// Returns a newly created string interpolation expression.
-  StringInterpolation stringInterpolation(List<InterpolationElement> elements);
-
-  /// Returns a newly created super invocation to invoke the inherited
-  /// constructor with the given name with the given arguments. The [period] and
-  /// [constructorName] can be `null` if the constructor being invoked is the
-  /// unnamed constructor.
-  SuperConstructorInvocation superConstructorInvocation(
-      Token superKeyword,
-      Token? period,
-      SimpleIdentifier? constructorName,
-      ArgumentList argumentList);
-
-  /// Returns a newly created super expression.
-  SuperExpression superExpression(Token superKeyword);
-
-  /// Returns a newly created super-initializer parameter. Either or both of
-  /// the [comment] and [metadata] can be `null` if the parameter does not have
-  /// the corresponding attribute. The [keyword] can be `null` if there is a
-  /// type. The [type] must be `null` if the keyword is 'var'. The [parameters]
-  /// can be `null` if this is not a function-typed super-initializer
-  /// parameter.
-  SuperFormalParameter superFormalParameter(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? covariantKeyword,
-      Token? requiredKeyword,
-      Token? keyword,
-      TypeAnnotation? type,
-      required Token superKeyword,
-      required Token period,
-      required SimpleIdentifier identifier,
-      TypeParameterList? typeParameters,
-      FormalParameterList? parameters,
-      Token? question});
-
-  /// Returns a newly created switch case. The list of [labels] can be `null`
-  /// if there are no labels.
-  SwitchCase switchCase(List<Label> labels, Token keyword,
-      Expression expression, Token colon, List<Statement> statements);
-
-  /// Returns a newly created switch default. The list of [labels] can be
-  /// `null` if there are no labels.
-  SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon,
-      List<Statement> statements);
-
-  /// Returns a newly created switch statement. The list of [members] can be
-  /// `null` if there are no switch members.
-  SwitchStatement switchStatement(
-      Token switchKeyword,
-      Token leftParenthesis,
-      Expression expression,
-      Token rightParenthesis,
-      Token leftBracket,
-      List<SwitchMember> members,
-      Token rightBracket);
-
-  /// Returns a newly created symbol literal.
-  SymbolLiteral symbolLiteral(Token poundSign, List<Token> components);
-
-  /// Returns a newly created this expression.
-  ThisExpression thisExpression(Token thisKeyword);
-
-  /// Returns a newly created throw expression.
-  ThrowExpression throwExpression(Token throwKeyword, Expression expression);
-
-  /// Returns a newly created top-level variable declaration. Either or both
-  /// of the [comment] and [metadata] can be `null` if the variable does not
-  /// have the corresponding attribute.
-  TopLevelVariableDeclaration topLevelVariableDeclaration(
-      Comment? comment,
-      List<Annotation>? metadata,
-      VariableDeclarationList variableList,
-      Token semicolon,
-      {Token? externalKeyword});
-
-  /// Returns a newly created try statement. The list of [catchClauses] can be
-  /// `null` if there are no catch clauses. The [finallyKeyword] and
-  /// [finallyBlock] can be `null` if there is no finally clause.
-  TryStatement tryStatement(
-      Token tryKeyword,
-      Block body,
-      List<CatchClause> catchClauses,
-      Token? finallyKeyword,
-      Block? finallyBlock);
-
-  /// Returns a newly created list of type arguments.
-  TypeArgumentList typeArgumentList(
-      Token leftBracket, List<TypeAnnotation> arguments, Token rightBracket);
-
-  /// Returns a newly created type literal.
-  TypeLiteral typeLiteral({required NamedType typeName});
-
-  /// Returns a newly created type parameter. Either or both of the [comment]
-  /// and [metadata] can be `null` if the parameter does not have the
-  /// corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
-  /// the parameter does not have an upper bound.
-  TypeParameter typeParameter(Comment? comment, List<Annotation>? metadata,
-      SimpleIdentifier name, Token? extendsKeyword, TypeAnnotation? bound);
-
-  /// Returns a newly created list of type parameters.
-  TypeParameterList typeParameterList(Token leftBracket,
-      List<TypeParameter> typeParameters, Token rightBracket);
-
-  /// Returns a newly created variable declaration. The [equals] and
-  /// [initializer] can be `null` if there is no initializer.
-  VariableDeclaration variableDeclaration(
-      SimpleIdentifier name, Token? equals, Expression? initializer);
-
-  /// Returns a newly created variable declaration list. Either or both of the
-  /// [comment] and [metadata] can be `null` if the variable list does not have
-  /// the corresponding attribute. The [keyword] can be `null` if a type was
-  /// specified. The [type] must be `null` if the keyword is 'var'.
-  ///
-  /// Use [variableDeclarationList2] instead.
-  VariableDeclarationList variableDeclarationList(
-      Comment? comment,
-      List<Annotation>? metadata,
-      Token? keyword,
-      TypeAnnotation? type,
-      List<VariableDeclaration> variables);
-
-  /// Returns a newly created variable declaration list. Either or both of the
-  /// [comment] and [metadata] can be `null` if the variable list does not have
-  /// the corresponding attribute. The [keyword] can be `null` if a type was
-  /// specified. The [type] must be `null` if the keyword is 'var'.
-  VariableDeclarationList variableDeclarationList2(
-      {Comment? comment,
-      List<Annotation>? metadata,
-      Token? lateKeyword,
-      Token? keyword,
-      TypeAnnotation? type,
-      required List<VariableDeclaration> variables});
-
-  /// Returns a newly created variable declaration statement.
-  VariableDeclarationStatement variableDeclarationStatement(
-      VariableDeclarationList variableList, Token semicolon);
-
-  /// Returns a newly created while statement.
-  WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis,
-      Expression condition, Token rightParenthesis, Statement body);
-
-  /// Returns a newly created with clause.
-  WithClause withClause(Token withKeyword, List<NamedType> mixinTypes);
-
-  /// Returns a newly created yield expression. The [star] can be `null` if no
-  /// star was provided.
-  YieldStatement yieldStatement(
-      Token yieldKeyword, Token? star, Expression expression, Token semicolon);
-}
diff --git a/pkg/analyzer/lib/dart/ast/standard_ast_factory.dart b/pkg/analyzer/lib/dart/ast/standard_ast_factory.dart
deleted file mode 100644
index 544346b..0000000
--- a/pkg/analyzer/lib/dart/ast/standard_ast_factory.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/ast/ast_factory.dart';
-import 'package:analyzer/src/dart/ast/ast_factory.dart';
-
-/// Gets an instance of [AstFactory] based on the standard AST implementation.
-@Deprecated('Should not be used by clients')
-final AstFactory astFactory = AstFactoryImpl();
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 3a393c3..a84c7ec 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -408,11 +408,6 @@
   /// compilation unit.
   List<FunctionElement> get functions;
 
-  /// Return `true` if this compilation unit defines a top-level function named
-  /// `loadLibrary`.
-  @Deprecated('Not useful for clients')
-  bool get hasLoadLibraryFunction;
-
   /// Return the [LineInfo] for the [source].
   LineInfo get lineInfo;
 
@@ -431,11 +426,6 @@
   /// compilation unit.
   List<TypeAliasElement> get typeAliases;
 
-  /// Return a list containing all of the classes contained in this compilation
-  /// unit.
-  @Deprecated('Use classes instead')
-  List<ClassElement> get types;
-
   /// Return the enum defined in this compilation unit that has the given
   /// [name], or `null` if this compilation unit does not define an enum with
   /// the given name.
@@ -520,13 +510,6 @@
 ///
 /// Clients may not extend, implement or mix-in this class.
 abstract class Element implements AnalysisTarget {
-  /// A comparator that can be used to sort elements by their name offset.
-  /// Elements with a smaller offset will be sorted to be before elements with a
-  /// larger name offset.
-  static final Comparator<Element> SORT_BY_OFFSET =
-      (Element firstElement, Element secondElement) =>
-          firstElement.nameOffset - secondElement.nameOffset;
-
   /// Return the analysis context in which this element is defined.
   AnalysisContext get context;
 
@@ -1296,12 +1279,6 @@
   /// Return the prefix that was specified as part of the import directive, or
   /// `null` if there was no prefix specified.
   PrefixElement? get prefix;
-
-  /// Return the offset of the prefix of this import in the file that contains
-  /// this import directive, or `-1` if this import is synthetic, does not have
-  /// a prefix, or otherwise does not have an offset.
-  @Deprecated('Use prefix.nameOffset instead')
-  int get prefixOffset;
 }
 
 /// A label associated with a statement.
@@ -1348,16 +1325,6 @@
   /// version override comment at the top of the file.
   FeatureSet get featureSet;
 
-  /// Return `true` if the defining compilation unit of this library contains at
-  /// least one import directive whose URI uses the "dart-ext" scheme.
-  @Deprecated('Support for dart-ext is replaced with FFI')
-  bool get hasExtUri;
-
-  /// Return `true` if this library defines a top-level function named
-  /// `loadLibrary`.
-  @Deprecated('Not useful for clients')
-  bool get hasLoadLibraryFunction;
-
   /// Return an identifier that uniquely identifies this element among the
   /// children of this element's parent.
   String get identifier;
diff --git a/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart b/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
index e5d5193..cd03107 100644
--- a/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
+++ b/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
@@ -29,56 +29,6 @@
 ///
 /// If [embedderYamlPath] is provided, then libraries from this file are
 /// appended to the libraries of the specified SDK.
-@Deprecated('Use buildSdkSummary2() instead')
-Uint8List buildSdkSummary({
-  required ResourceProvider resourceProvider,
-  required String sdkPath,
-  String? embedderYamlPath,
-}) {
-  var sdk = FolderBasedDartSdk(
-    resourceProvider,
-    resourceProvider.getFolder(sdkPath),
-  );
-
-  // Append libraries from the embedder.
-  if (embedderYamlPath != null) {
-    var file = resourceProvider.getFile(embedderYamlPath);
-    var content = file.readAsStringSync();
-    var map = loadYaml(content) as YamlMap;
-    var embedderSdk = EmbedderSdk(
-      resourceProvider,
-      {file.parent: map},
-      languageVersion: sdk.languageVersion,
-    );
-    for (var library in embedderSdk.sdkLibraries) {
-      var uriStr = library.shortName;
-      if (sdk.libraryMap.getLibrary(uriStr) == null) {
-        sdk.libraryMap.setLibrary(uriStr, library);
-      }
-    }
-  }
-
-  var librarySources = sdk.sdkLibraries.map((e) {
-    return sdk.mapDartUri(e.shortName)!;
-  }).toList();
-
-  var analysisContext = AnalysisContextImpl(
-    SynchronousSession(AnalysisOptionsImpl(), DeclaredVariables()),
-    SourceFactory([DartUriResolver(sdk)]),
-  );
-
-  return _Builder(
-    analysisContext,
-    sdk.allowedExperimentsJson,
-    sdk.languageVersion,
-    librarySources,
-  ).build();
-}
-
-/// Build summary for SDK at the given [sdkPath].
-///
-/// If [embedderYamlPath] is provided, then libraries from this file are
-/// appended to the libraries of the specified SDK.
 Future<Uint8List> buildSdkSummary2({
   required ResourceProvider resourceProvider,
   required String sdkPath,
@@ -121,7 +71,7 @@
     sdk.allowedExperimentsJson,
     sdk.languageVersion,
     librarySources,
-  ).build2();
+  ).build();
 }
 
 class _Builder {
@@ -145,39 +95,7 @@
   }
 
   /// Build the linked bundle and return its bytes.
-  @deprecated
-  Uint8List build() {
-    librarySources.forEach(_addLibrary);
-
-    var elementFactory = LinkedElementFactory(
-      context,
-      AnalysisSessionImpl(
-        _FakeAnalysisDriver(),
-      ),
-      Reference.root(),
-    );
-
-    var linkResult = link(elementFactory, inputLibraries);
-
-    var bundleBuilder = PackageBundleBuilder();
-    for (var library in inputLibraries) {
-      bundleBuilder.addLibrary(
-        library.uriStr,
-        library.units.map((e) => e.uriStr).toList(),
-      );
-    }
-    return bundleBuilder.finish(
-      resolutionBytes: linkResult.resolutionBytes,
-      sdk: PackageBundleSdk(
-        languageVersionMajor: languageVersion.major,
-        languageVersionMinor: languageVersion.minor,
-        allowedExperimentsJson: allowedExperimentsJson,
-      ),
-    );
-  }
-
-  /// Build the linked bundle and return its bytes.
-  Future<Uint8List> build2() async {
+  Future<Uint8List> build() async {
     librarySources.forEach(_addLibrary);
 
     var elementFactory = LinkedElementFactory(
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index 113f4bb..88555b2 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -57,7 +57,7 @@
   /// given [_errorListener]. Errors will be reported against the
   /// [_defaultSource] unless another source is provided later.
   ErrorReporter(this._errorListener, this._source,
-      {this.isNonNullableByDefault = false});
+      {required this.isNonNullableByDefault});
 
   Source get source => _source;
 
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 6f8edc5..b55664e 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -146,21 +146,12 @@
     _notifyWatchers(path, ChangeType.MODIFY);
   }
 
-  File newFile(
-    String path,
-    String content, [
-    @Deprecated('This parameter is not used and will be removed') int? stamp,
-  ]) {
+  File newFile(String path, String content) {
     var bytes = utf8.encode(content) as Uint8List;
-    // ignore: deprecated_member_use_from_same_package
-    return newFileWithBytes(path, bytes, stamp);
+    return newFileWithBytes(path, bytes);
   }
 
-  File newFileWithBytes(
-    String path,
-    List<int> bytes, [
-    @Deprecated('This parameter is not used and will be removed') int? stamp,
-  ]) {
+  File newFileWithBytes(String path, List<int> bytes) {
     _ensureAbsoluteAndNormalized(path);
     bytes = bytes is Uint8List ? bytes : Uint8List.fromList(bytes);
 
diff --git a/pkg/analyzer/lib/src/context/source.dart b/pkg/analyzer/lib/src/context/source.dart
index b603111..f7d4c55 100644
--- a/pkg/analyzer/lib/src/context/source.dart
+++ b/pkg/analyzer/lib/src/context/source.dart
@@ -11,7 +11,6 @@
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart' as utils;
 import 'package:analyzer/src/source/package_map_resolver.dart';
-import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/util/file_paths.dart' as file_paths;
 import 'package:analyzer/src/workspace/package_build.dart';
 
@@ -139,15 +138,6 @@
     }
   }
 
-  @Deprecated('Use pathToUri() instead')
-  @override
-  Uri? restoreUri(Source source) {
-    if (source is InSummarySource) {
-      return source.uri;
-    }
-    return pathToUri(source.fullName);
-  }
-
   /// Return a source object representing the URI that results from resolving
   /// the given (possibly relative) contained URI against the URI associated
   /// with an existing source object, or `null` if the URI could not be
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 46404b1..56950bb 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -85,8 +85,6 @@
   /// The version of data format, should be incremented on every format change.
   static const int DATA_VERSION = 212;
 
-  static const bool _applyFileChangesSynchronously = true;
-
   /// The number of exception contexts allowed to write. Once this field is
   /// zero, we stop writing any new exception contexts in this process.
   static int allowedNumberOfContextsToWrite = 10;
@@ -302,7 +300,7 @@
 
   @override
   bool get hasFilesToAnalyze {
-    return _pendingFileChanges.isNotEmpty ||
+    return hasPendingFileChanges ||
         _fileTracker.hasChangedFiles ||
         _requestedFiles.isNotEmpty ||
         _requestedParts.isNotEmpty ||
@@ -310,6 +308,8 @@
         _partsToAnalyze.isNotEmpty;
   }
 
+  bool get hasPendingFileChanges => _pendingFileChanges.isNotEmpty;
+
   /// Return the set of files that are known at this moment. This set does not
   /// always include all added files or all implicitly used file. If a file has
   /// not been processed yet, it might be missing.
@@ -461,14 +461,9 @@
     }
     if (file_paths.isDart(resourceProvider.pathContext, path)) {
       _priorityResults.clear();
-      if (_applyFileChangesSynchronously) {
-        _removePotentiallyAffectedLibraries(_accumulatedAffected, path);
-        _fileTracker.addFile(path);
-      } else {
-        _pendingFileChanges.add(
-          _FileChange(path, _FileChangeKind.add),
-        );
-      }
+      _pendingFileChanges.add(
+        _FileChange(path, _FileChangeKind.add),
+      );
       _scheduler.notify(this);
     }
   }
@@ -517,14 +512,9 @@
     }
     if (file_paths.isDart(resourceProvider.pathContext, path)) {
       _priorityResults.clear();
-      if (_applyFileChangesSynchronously) {
-        _removePotentiallyAffectedLibraries(_accumulatedAffected, path);
-        _fileTracker.changeFile(path);
-      } else {
-        _pendingFileChanges.add(
-          _FileChange(path, _FileChangeKind.change),
-        );
-      }
+      _pendingFileChanges.add(
+        _FileChange(path, _FileChangeKind.change),
+      );
       _scheduler.notify(this);
     }
   }
@@ -671,9 +661,7 @@
       return InvalidPathResult();
     }
 
-    _applyPendingFileChanges();
-
-    FileState file = _fileTracker.getFile(path);
+    FileState file = _fsState.getFileForPath(path);
     return FileResultImpl(
         currentSession, path, file.uri, file.lineInfo, file.isPart);
   }
@@ -707,7 +695,7 @@
 
   /// Return [LibraryElementResult] for the given [file], or `null` if the
   /// file is a part.
-  LibraryElement? getLibraryByFile(FileState file) {
+  Future<LibraryElement?> getLibraryByFile(FileState file) async {
     if (file.isPart) {
       return null;
     }
@@ -717,7 +705,7 @@
       return element;
     }
 
-    libraryContext.load2(file);
+    await libraryContext.load(file);
     return libraryContext.getLibraryElement(file.uri);
   }
 
@@ -978,8 +966,6 @@
       );
     }
 
-    _applyPendingFileChanges();
-
     var completer = Completer<UnitElementResult>();
     _unitElementRequestedFiles
         .putIfAbsent(path, () => <Completer<UnitElementResult>>[])
@@ -1034,9 +1020,7 @@
       return InvalidPathResult();
     }
 
-    _applyPendingFileChanges();
-
-    FileState file = _fileTracker.getFile(path);
+    FileState file = _fsState.getFileForPath(path);
     RecordingErrorListener listener = RecordingErrorListener();
     CompilationUnit unit = file.parse(listener);
     return ParsedUnitResultImpl(currentSession, file.path, file.uri,
@@ -1072,7 +1056,7 @@
     if (_requestedFiles.isNotEmpty) {
       String path = _requestedFiles.keys.first;
       try {
-        var result = _computeAnalysisResult(path, withUnit: true);
+        var result = await _computeAnalysisResult(path, withUnit: true);
         // If a part without a library, delay its analysis.
         if (result == null) {
           _requestedParts
@@ -1102,7 +1086,7 @@
     if (_requestedLibraries.isNotEmpty) {
       String path = _requestedLibraries.keys.first;
       try {
-        var result = _computeResolvedLibrary(path);
+        var result = await _computeResolvedLibrary(path);
         for (var completer in _requestedLibraries.remove(path)!) {
           completer.complete(result);
         }
@@ -1119,7 +1103,10 @@
     if (_errorsRequestedFiles.isNotEmpty) {
       var path = _errorsRequestedFiles.keys.first;
       var completers = _errorsRequestedFiles.remove(path)!;
-      var result = _computeErrors(path: path, asIsIfPartWithoutLibrary: false);
+      var result = await _computeErrors(
+        path: path,
+        asIsIfPartWithoutLibrary: false,
+      );
       if (result != null) {
         for (var completer in completers) {
           completer.complete(result);
@@ -1133,7 +1120,7 @@
     // Process an index request.
     if (_indexRequestedFiles.isNotEmpty) {
       String path = _indexRequestedFiles.keys.first;
-      AnalysisDriverUnitIndex index = _computeIndex(path);
+      AnalysisDriverUnitIndex index = await _computeIndex(path);
       for (var completer in _indexRequestedFiles.remove(path)!) {
         completer.complete(index);
       }
@@ -1143,7 +1130,7 @@
     // Process a unit element request.
     if (_unitElementRequestedFiles.isNotEmpty) {
       String path = _unitElementRequestedFiles.keys.first;
-      UnitElementResult? result = _computeUnitElement(path);
+      UnitElementResult? result = await _computeUnitElement(path);
       var completers = _unitElementRequestedFiles.remove(path)!;
       if (result != null) {
         for (var completer in completers) {
@@ -1190,7 +1177,7 @@
       for (String path in _priorityFiles) {
         if (_fileTracker.isFilePending(path)) {
           try {
-            var result = _computeAnalysisResult(path, withUnit: true);
+            var result = await _computeAnalysisResult(path, withUnit: true);
             if (result == null) {
               _partsToAnalyze.add(path);
             } else {
@@ -1211,7 +1198,7 @@
     if (_fileTracker.hasPendingFiles) {
       String path = _fileTracker.anyPendingFile;
       try {
-        var result = _computeAnalysisResult(path,
+        var result = await _computeAnalysisResult(path,
             withUnit: false, skipIfSameSignature: true);
         if (result == null) {
           _partsToAnalyze.add(path);
@@ -1235,8 +1222,9 @@
     if (_requestedParts.isNotEmpty) {
       String path = _requestedParts.keys.first;
       try {
-        var result = _computeAnalysisResult(path,
-            withUnit: true, asIsIfPartWithoutLibrary: true)!;
+        var result = await _computeAnalysisResult(path,
+            withUnit: true, asIsIfPartWithoutLibrary: true);
+        result!;
         // Notify the completers.
         for (var completer in _requestedParts.remove(path)!) {
           completer.complete(result.unitResult!);
@@ -1262,13 +1250,13 @@
       try {
         var withUnit = _priorityFiles.contains(path);
         if (withUnit) {
-          var result = _computeAnalysisResult(path,
-              withUnit: true, asIsIfPartWithoutLibrary: true)!;
-          _resultController.add(result.unitResult!);
+          var result = await _computeAnalysisResult(path,
+              withUnit: true, asIsIfPartWithoutLibrary: true);
+          _resultController.add(result!.unitResult!);
         } else {
-          var result = _computeAnalysisResult(path,
-              withUnit: false, asIsIfPartWithoutLibrary: true)!;
-          _resultController.add(result.errorsResult!);
+          var result = await _computeAnalysisResult(path,
+              withUnit: false, asIsIfPartWithoutLibrary: true);
+          _resultController.add(result!.errorsResult!);
         }
       } catch (exception, stackTrace) {
         _reportException(path, exception, stackTrace);
@@ -1280,8 +1268,9 @@
     // Process a unit element request for a part.
     if (_unitElementRequestedParts.isNotEmpty) {
       String path = _unitElementRequestedParts.keys.first;
-      UnitElementResult result =
-          _computeUnitElement(path, asIsIfPartWithoutLibrary: true)!;
+      var result =
+          await _computeUnitElement(path, asIsIfPartWithoutLibrary: true);
+      result!;
       for (var completer in _unitElementRequestedParts.remove(path)!) {
         completer.complete(result);
       }
@@ -1292,7 +1281,10 @@
     if (_errorsRequestedParts.isNotEmpty) {
       var path = _errorsRequestedParts.keys.first;
       var completers = _errorsRequestedParts.remove(path)!;
-      var result = _computeErrors(path: path, asIsIfPartWithoutLibrary: true);
+      var result = await _computeErrors(
+        path: path,
+        asIsIfPartWithoutLibrary: true,
+      );
       for (var completer in completers) {
         completer.complete(result);
       }
@@ -1315,23 +1307,18 @@
     if (file_paths.isDart(resourceProvider.pathContext, path)) {
       _lastProducedSignatures.remove(path);
       _priorityResults.clear();
-      if (_applyFileChangesSynchronously) {
-        _removePotentiallyAffectedLibraries(_accumulatedAffected, path);
-        _fileTracker.removeFile(path);
-      } else {
-        _pendingFileChanges.add(
-          _FileChange(path, _FileChangeKind.remove),
-        );
-      }
+      _pendingFileChanges.add(
+        _FileChange(path, _FileChangeKind.remove),
+      );
       _scheduler.notify(this);
     }
   }
 
-  ResolvedForCompletionResultImpl? resolveForCompletion({
+  Future<ResolvedForCompletionResultImpl?> resolveForCompletion({
     required String path,
     required int offset,
     required OperationPerformanceImpl performance,
-  }) {
+  }) async {
     if (!_isAbsolutePath(path)) {
       return null;
     }
@@ -1350,7 +1337,7 @@
       return null;
     }
 
-    libraryContext.load2(library);
+    await libraryContext.load(library);
     var unitElement = libraryContext.computeUnitElement(library, file)
         as CompilationUnitElementImpl;
 
@@ -1445,10 +1432,10 @@
   /// Return [AnalysisResult._UNCHANGED] if [skipIfSameSignature] is `true` and
   /// the resolved signature of the file in its library is the same as the one
   /// that was the most recently produced to the client.
-  AnalysisResult? _computeAnalysisResult(String path,
+  Future<AnalysisResult?> _computeAnalysisResult(String path,
       {required bool withUnit,
       bool asIsIfPartWithoutLibrary = false,
-      bool skipIfSameSignature = false}) {
+      bool skipIfSameSignature = false}) async {
     FileState file = _fsState.getFileForPath(path);
 
     // Prepare the library - the file itself, or the known library.
@@ -1482,7 +1469,7 @@
     }
 
     // We need the fully resolved unit, or the result is not cached.
-    return _logger.run('Compute analysis result for $path', () {
+    return _logger.runAsync('Compute analysis result for $path', () async {
       _logger.writeln('Work in $name');
       try {
         _testView.numOfAnalyzedLibraries++;
@@ -1495,7 +1482,7 @@
           return _newMissingDartLibraryResult(file, 'dart:async');
         }
 
-        libraryContext.load2(library!);
+        await libraryContext.load(library!);
 
         var results = LibraryAnalyzer(
           analysisOptions as AnalysisOptionsImpl,
@@ -1539,11 +1526,11 @@
     });
   }
 
-  ErrorsResult? _computeErrors({
+  Future<ErrorsResult?> _computeErrors({
     required String path,
     required bool asIsIfPartWithoutLibrary,
-  }) {
-    var analysisResult = _computeAnalysisResult(path,
+  }) async {
+    var analysisResult = await _computeAnalysisResult(path,
         withUnit: false, asIsIfPartWithoutLibrary: asIsIfPartWithoutLibrary);
 
     if (analysisResult == null) {
@@ -1553,20 +1540,20 @@
     return analysisResult.errorsResult;
   }
 
-  AnalysisDriverUnitIndex _computeIndex(String path) {
-    var analysisResult = _computeAnalysisResult(path,
+  Future<AnalysisDriverUnitIndex> _computeIndex(String path) async {
+    var analysisResult = await _computeAnalysisResult(path,
         withUnit: false, asIsIfPartWithoutLibrary: true);
     return analysisResult!._index!;
   }
 
   /// Return the newly computed resolution result of the library with the
   /// given [path].
-  ResolvedLibraryResultImpl _computeResolvedLibrary(String path) {
+  Future<ResolvedLibraryResultImpl> _computeResolvedLibrary(String path) async {
     FileState library = _fsState.getFileForPath(path);
 
-    return _logger.run('Compute resolved library $path', () {
+    return _logger.runAsync('Compute resolved library $path', () async {
       _testView.numOfAnalyzedLibraries++;
-      libraryContext.load2(library);
+      await libraryContext.load(library);
 
       var unitResults = LibraryAnalyzer(
               analysisOptions as AnalysisOptionsImpl,
@@ -1604,8 +1591,8 @@
     });
   }
 
-  UnitElementResult? _computeUnitElement(String path,
-      {bool asIsIfPartWithoutLibrary = false}) {
+  Future<UnitElementResult?> _computeUnitElement(String path,
+      {bool asIsIfPartWithoutLibrary = false}) async {
     FileState file = _fsState.getFileForPath(path);
 
     // Prepare the library - the file itself, or the known library.
@@ -1618,9 +1605,9 @@
       }
     }
 
-    return _logger.run('Compute unit element for $path', () {
+    return _logger.runAsync('Compute unit element for $path', () async {
       _logger.writeln('Work in $name');
-      libraryContext.load2(library!);
+      await libraryContext.load(library!);
       var element = libraryContext.computeUnitElement(library, file);
       return UnitElementResultImpl(
         currentSession,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
index 394b920..b54b4c4 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
@@ -9,7 +9,6 @@
 import 'package:analyzer/src/dart/analysis/driver.dart' show AnalysisDriver;
 import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptions;
-import 'package:analyzer/src/workspace/workspace.dart';
 
 /// An analysis context whose implementation is based on an analysis driver.
 class DriverBasedAnalysisContext implements AnalysisContext {
@@ -48,12 +47,6 @@
     return null;
   }
 
-  @Deprecated('Use contextRoot.workspace instead')
-  @override
-  Workspace get workspace {
-    return contextRoot.workspace;
-  }
-
   @override
   Future<List<String>> applyPendingFileChanges() {
     return driver.applyPendingFileChanges();
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
index 887f450..1e42d8e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
@@ -126,18 +126,6 @@
     _pendingFiles.remove(path);
   }
 
-  /// Return the [FileState] suitable only when the file is used by itself.
-  /// If the file is in the set of changed files, it is refreshed first.
-  /// If the file is not in the set of changed files, it is not refreshed.
-  FileState getFile(String path) {
-    // Read any files that we were told were changed.
-    // But don't read the requested file explicitly.
-    // Read it only if it is in this set of changed files.
-    while (verifyChangedFilesIfNeeded()) {}
-
-    return _fsState.getFileForPath(path);
-  }
-
   /// Returns a boolean indicating whether the given [path] points to a file
   /// that requires analysis.
   bool isFilePending(String path) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index 091145d..fa6f1f2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -31,7 +31,7 @@
 var timerBundleToBytes = Stopwatch(); // TODO(scheglov) use
 var timerInputLibraries = Stopwatch();
 var timerLinking = Stopwatch();
-var timerLoad2 = Stopwatch();
+var timerLoad = Stopwatch();
 
 /// Context information necessary to analyze one or more libraries within an
 /// [AnalysisDriver].
@@ -104,8 +104,8 @@
   }
 
   /// Load data required to access elements of the given [targetLibrary].
-  void load2(FileState targetLibrary) {
-    timerLoad2.start();
+  Future<void> load(FileState targetLibrary) async {
+    timerLoad.start();
     var librariesTotal = 0;
     var librariesLoaded = 0;
     var librariesLinked = 0;
@@ -114,7 +114,7 @@
     var bytesGet = 0;
     var bytesPut = 0;
 
-    void loadBundle(LibraryCycle cycle) {
+    Future<void> loadBundle(LibraryCycle cycle) async {
       if (cycle.libraries.isEmpty ||
           elementFactory.hasLibrary(cycle.libraries.first.uriStr)) {
         return;
@@ -122,7 +122,9 @@
 
       librariesTotal += cycle.libraries.length;
 
-      cycle.directDependencies.forEach(loadBundle);
+      for (var directDependency in cycle.directDependencies) {
+        await loadBundle(directDependency);
+      }
 
       var unitsInformativeBytes = <Uri, Uint8List>{};
       var macroLibraries = <MacroLibrary>[];
@@ -206,7 +208,7 @@
           timerLinking.start();
           // TODO(scheglov) Migrate when we are ready to switch to async.
           // ignore: deprecated_member_use_from_same_package
-          linkResult = link2.link(elementFactory, inputLibraries);
+          linkResult = await link2.link2(elementFactory, inputLibraries);
           librariesLinked += cycle.libraries.length;
           counterLinkedLibraries += inputLibraries.length;
           timerLinking.stop();
@@ -245,9 +247,9 @@
       }
     }
 
-    logger.run('Prepare linked bundles', () {
+    await logger.runAsync('Prepare linked bundles', () async {
       var libraryCycle = targetLibrary.libraryCycle;
-      loadBundle(libraryCycle);
+      await loadBundle(libraryCycle);
       logger.writeln(
         '[librariesTotal: $librariesTotal]'
         '[librariesLoaded: $librariesLoaded]'
@@ -263,7 +265,7 @@
     // exists without doing any work. But the type provider must be created.
     _createElementFactoryTypeProvider();
 
-    timerLoad2.stop();
+    timerLoad.stop();
   }
 
   /// Ensure that type provider is created.
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 477404f..ac46094 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -788,7 +788,7 @@
     var filesProcessed = 0;
     try {
       for (var file in knownFiles) {
-        var libraryElement = driver.getLibraryByFile(file);
+        var libraryElement = await driver.getLibraryByFile(file);
         if (libraryElement != null) {
           _addUnits(file, libraryElement.units);
         }
diff --git a/pkg/analyzer/lib/src/dart/analysis/session.dart b/pkg/analyzer/lib/src/dart/analysis/session.dart
index eef485d..350bba5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/session.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/session.dart
@@ -129,7 +129,7 @@
   /// Check to see that results from this session will be consistent, and throw
   /// an [InconsistentAnalysisException] if they might not be.
   void _checkConsistency() {
-    if (_driver.currentSession != this) {
+    if (_driver.hasPendingFileChanges || _driver.currentSession != this) {
       throw InconsistentAnalysisException();
     }
   }
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index 7a31a07..c7e7104 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -5,7 +5,6 @@
 import 'package:_fe_analyzer_shared/src/scanner/token.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/ast_factory.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/source/line_info.dart';
@@ -15,13 +14,10 @@
 /// The instance of [AstFactoryImpl].
 final AstFactoryImpl astFactory = AstFactoryImpl();
 
-// ignore: deprecated_member_use_from_same_package
-class AstFactoryImpl extends AstFactory {
-  @override
+class AstFactoryImpl {
   AdjacentStringsImpl adjacentStrings(List<StringLiteral> strings) =>
       AdjacentStringsImpl(strings);
 
-  @override
   AnnotationImpl annotation(
           {required Token atSign,
           required Identifier name,
@@ -37,18 +33,15 @@
           constructorName as SimpleIdentifierImpl?,
           arguments as ArgumentListImpl?);
 
-  @override
   ArgumentListImpl argumentList(Token leftParenthesis,
           List<Expression> arguments, Token rightParenthesis) =>
       ArgumentListImpl(leftParenthesis, arguments, rightParenthesis);
 
-  @override
   AsExpressionImpl asExpression(
           Expression expression, Token asOperator, TypeAnnotation type) =>
       AsExpressionImpl(
           expression as ExpressionImpl, asOperator, type as TypeAnnotationImpl);
 
-  @override
   AssertInitializerImpl assertInitializer(
           Token assertKeyword,
           Token leftParenthesis,
@@ -64,7 +57,6 @@
           message as ExpressionImpl?,
           rightParenthesis);
 
-  @override
   AssertStatementImpl assertStatement(
           Token assertKeyword,
           Token leftParenthesis,
@@ -82,19 +74,15 @@
           rightParenthesis,
           semicolon);
 
-  @override
   AssignmentExpressionImpl assignmentExpression(
           Expression leftHandSide, Token operator, Expression rightHandSide) =>
       AssignmentExpressionImpl(leftHandSide as ExpressionImpl, operator,
           rightHandSide as ExpressionImpl);
 
-  @override
   AwaitExpressionImpl awaitExpression(
           Token awaitKeyword, Expression expression) =>
       AwaitExpressionImpl(awaitKeyword, expression as ExpressionImpl);
 
-  @Deprecated('Use the constructor instead.')
-  @override
   BinaryExpressionImpl binaryExpression(
           Expression leftOperand, Token operator, Expression rightOperand) =>
       BinaryExpressionImpl(
@@ -103,36 +91,29 @@
         rightOperand: rightOperand as ExpressionImpl,
       );
 
-  @override
   BlockImpl block(
           Token leftBracket, List<Statement> statements, Token rightBracket) =>
       BlockImpl(leftBracket, statements, rightBracket);
 
-  @override
   CommentImpl blockComment(List<Token> tokens) =>
       CommentImpl.createBlockComment(tokens);
 
-  @override
   BlockFunctionBodyImpl blockFunctionBody(
           Token? keyword, Token? star, Block block) =>
       BlockFunctionBodyImpl(keyword, star, block as BlockImpl);
 
-  @override
   BooleanLiteralImpl booleanLiteral(Token literal, bool value) =>
       BooleanLiteralImpl(literal, value);
 
-  @override
   BreakStatementImpl breakStatement(
           Token breakKeyword, SimpleIdentifier? label, Token semicolon) =>
       BreakStatementImpl(
           breakKeyword, label as SimpleIdentifierImpl?, semicolon);
 
-  @override
   CascadeExpressionImpl cascadeExpression(
           Expression target, List<Expression> cascadeSections) =>
       CascadeExpressionImpl(target as ExpressionImpl, cascadeSections);
 
-  @override
   CatchClauseImpl catchClause(
           Token? onKeyword,
           TypeAnnotation? exceptionType,
@@ -154,7 +135,6 @@
           rightParenthesis,
           body as BlockImpl);
 
-  @override
   ClassDeclarationImpl classDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -186,7 +166,6 @@
           members,
           rightBracket);
 
-  @override
   ClassTypeAliasImpl classTypeAlias(
           Comment? comment,
           List<Annotation>? metadata,
@@ -216,13 +195,11 @@
           implementsClause as ImplementsClauseImpl?,
           semicolon);
 
-  @override
   CommentReferenceImpl commentReference(
           Token? newKeyword, CommentReferableExpression expression) =>
       CommentReferenceImpl(
           newKeyword, expression as CommentReferableExpressionImpl);
 
-  @override
   CompilationUnitImpl compilationUnit(
           {required Token beginToken,
           ScriptTag? scriptTag,
@@ -238,7 +215,6 @@
       CompilationUnitImpl(beginToken, scriptTag as ScriptTagImpl?, directives,
           declarations, endToken, featureSet, lineInfo ?? LineInfo([0]));
 
-  @override
   ConditionalExpressionImpl conditionalExpression(
           Expression condition,
           Token question,
@@ -252,7 +228,6 @@
           colon,
           elseExpression as ExpressionImpl);
 
-  @override
   ConfigurationImpl configuration(
           Token ifKeyword,
           Token leftParenthesis,
@@ -270,7 +245,6 @@
           rightParenthesis,
           libraryUri as StringLiteralImpl);
 
-  @override
   ConstructorDeclarationImpl constructorDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -300,7 +274,6 @@
           redirectedConstructor as ConstructorNameImpl?,
           body as FunctionBodyImpl);
 
-  @override
   ConstructorFieldInitializerImpl constructorFieldInitializer(
           Token? thisKeyword,
           Token? period,
@@ -314,24 +287,20 @@
           equals,
           expression as ExpressionImpl);
 
-  @override
   ConstructorNameImpl constructorName(
           NamedType type, Token? period, SimpleIdentifier? name) =>
       ConstructorNameImpl(
           type as NamedTypeImpl, period, name as SimpleIdentifierImpl?);
 
-  @override
   ConstructorReferenceImpl constructorReference(
           {required ConstructorName constructorName}) =>
       ConstructorReferenceImpl(constructorName as ConstructorNameImpl);
 
-  @override
   ContinueStatementImpl continueStatement(
           Token continueKeyword, SimpleIdentifier? label, Token semicolon) =>
       ContinueStatementImpl(
           continueKeyword, label as SimpleIdentifierImpl?, semicolon);
 
-  @override
   DeclaredIdentifierImpl declaredIdentifier(
           Comment? comment,
           List<Annotation>? metadata,
@@ -341,7 +310,6 @@
       DeclaredIdentifierImpl(comment as CommentImpl?, metadata, keyword,
           type as TypeAnnotationImpl?, identifier as SimpleIdentifierImpl);
 
-  @override
   DefaultFormalParameterImpl defaultFormalParameter(
           NormalFormalParameter parameter,
           ParameterKind kind,
@@ -350,13 +318,11 @@
       DefaultFormalParameterImpl(parameter as NormalFormalParameterImpl, kind,
           separator, defaultValue as ExpressionImpl?);
 
-  @override
   CommentImpl documentationComment(List<Token> tokens,
           [List<CommentReference>? references]) =>
       CommentImpl.createDocumentationCommentWithReferences(
           tokens, references ?? <CommentReference>[]);
 
-  @override
   DoStatementImpl doStatement(
           Token doKeyword,
           Statement body,
@@ -374,27 +340,21 @@
           rightParenthesis,
           semicolon);
 
-  @override
   DottedNameImpl dottedName(List<SimpleIdentifier> components) =>
       DottedNameImpl(components);
 
-  @override
   DoubleLiteralImpl doubleLiteral(Token literal, double value) =>
       DoubleLiteralImpl(literal, value);
 
-  @override
   EmptyFunctionBodyImpl emptyFunctionBody(Token semicolon) =>
       EmptyFunctionBodyImpl(semicolon);
 
-  @override
   EmptyStatementImpl emptyStatement(Token semicolon) =>
       EmptyStatementImpl(semicolon);
 
-  @override
   CommentImpl endOfLineComment(List<Token> tokens) =>
       CommentImpl.createEndOfLineComment(tokens);
 
-  @override
   EnumConstantDeclarationImpl enumConstantDeclaration(Comment? comment,
           List<Annotation>? metadata, SimpleIdentifier name) =>
       EnumConstantDeclarationImpl(
@@ -405,7 +365,6 @@
       );
 
   @Deprecated('Use enumDeclaration2() instead')
-  @override
   EnumDeclarationImpl enumDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -428,7 +387,6 @@
           members: [],
           rightBracket: rightBracket);
 
-  @override
   EnumDeclarationImpl enumDeclaration2({
     required Comment? comment,
     required List<Annotation>? metadata,
@@ -459,7 +417,6 @@
     );
   }
 
-  @override
   ExportDirectiveImpl exportDirective(
           Comment? comment,
           List<Annotation>? metadata,
@@ -477,13 +434,11 @@
           combinators,
           semicolon);
 
-  @override
   ExpressionFunctionBodyImpl expressionFunctionBody(Token? keyword,
           Token functionDefinition, Expression expression, Token? semicolon) =>
       ExpressionFunctionBodyImpl(keyword, null, functionDefinition,
           expression as ExpressionImpl, semicolon);
 
-  @override
   ExpressionFunctionBodyImpl expressionFunctionBody2({
     Token? keyword,
     Token? star,
@@ -494,16 +449,13 @@
       ExpressionFunctionBodyImpl(keyword, star, functionDefinition,
           expression as ExpressionImpl, semicolon);
 
-  @override
   ExpressionStatementImpl expressionStatement(
           Expression expression, Token? semicolon) =>
       ExpressionStatementImpl(expression as ExpressionImpl, semicolon);
 
-  @override
   ExtendsClauseImpl extendsClause(Token extendsKeyword, NamedType superclass) =>
       ExtendsClauseImpl(extendsKeyword, superclass as NamedTypeImpl);
 
-  @override
   ExtensionDeclarationImpl extensionDeclaration(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -533,7 +485,6 @@
           members,
           rightBracket);
 
-  @override
   ExtensionOverrideImpl extensionOverride(
           {required Identifier extensionName,
           TypeArgumentList? typeArguments,
@@ -543,7 +494,6 @@
           typeArguments as TypeArgumentListImpl?,
           argumentList as ArgumentListImpl);
 
-  @override
   FieldDeclarationImpl fieldDeclaration2(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -565,7 +515,6 @@
           fieldList as VariableDeclarationListImpl,
           semicolon);
 
-  @override
   FieldFormalParameterImpl fieldFormalParameter2(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -593,7 +542,6 @@
           parameters as FormalParameterListImpl?,
           question);
 
-  @override
   ForEachPartsWithDeclarationImpl forEachPartsWithDeclaration(
           {required DeclaredIdentifier loopVariable,
           required Token inKeyword,
@@ -601,7 +549,6 @@
       ForEachPartsWithDeclarationImpl(loopVariable as DeclaredIdentifierImpl,
           inKeyword, iterable as ExpressionImpl);
 
-  @override
   ForEachPartsWithIdentifierImpl forEachPartsWithIdentifier(
           {required SimpleIdentifier identifier,
           required Token inKeyword,
@@ -609,7 +556,6 @@
       ForEachPartsWithIdentifierImpl(identifier as SimpleIdentifierImpl,
           inKeyword, iterable as ExpressionImpl);
 
-  @override
   ForElementImpl forElement(
           {Token? awaitKeyword,
           required Token forKeyword,
@@ -625,7 +571,6 @@
           rightParenthesis,
           body as CollectionElementImpl);
 
-  @override
   FormalParameterListImpl formalParameterList(
           Token leftParenthesis,
           List<FormalParameter> parameters,
@@ -635,7 +580,6 @@
       FormalParameterListImpl(leftParenthesis, parameters, leftDelimiter,
           rightDelimiter, rightParenthesis);
 
-  @override
   ForPartsWithDeclarationsImpl forPartsWithDeclarations(
           {required VariableDeclarationList variables,
           required Token leftSeparator,
@@ -649,7 +593,6 @@
           rightSeparator,
           updaters);
 
-  @override
   ForPartsWithExpressionImpl forPartsWithExpression(
           {Expression? initialization,
           required Token leftSeparator,
@@ -663,7 +606,6 @@
           rightSeparator,
           updaters);
 
-  @override
   ForStatementImpl forStatement(
       {Token? awaitKeyword,
       required Token forKeyword,
@@ -680,7 +622,6 @@
         body as StatementImpl);
   }
 
-  @override
   FunctionDeclarationImpl functionDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -700,19 +641,16 @@
           name as SimpleIdentifierImpl,
           functionExpression as FunctionExpressionImpl);
 
-  @override
   FunctionDeclarationStatementImpl functionDeclarationStatement(
           FunctionDeclaration functionDeclaration) =>
       FunctionDeclarationStatementImpl(
           functionDeclaration as FunctionDeclarationImpl);
 
-  @override
   FunctionExpressionImpl functionExpression(TypeParameterList? typeParameters,
           FormalParameterList? parameters, FunctionBody body) =>
       FunctionExpressionImpl(typeParameters as TypeParameterListImpl?,
           parameters as FormalParameterListImpl?, body as FunctionBodyImpl);
 
-  @override
   FunctionExpressionInvocationImpl functionExpressionInvocation(
           Expression function,
           TypeArgumentList? typeArguments,
@@ -722,13 +660,11 @@
           typeArguments as TypeArgumentListImpl?,
           argumentList as ArgumentListImpl);
 
-  @override
   FunctionReferenceImpl functionReference(
           {required Expression function, TypeArgumentList? typeArguments}) =>
       FunctionReferenceImpl(function as ExpressionImpl,
           typeArguments: typeArguments as TypeArgumentListImpl?);
 
-  @override
   FunctionTypeAliasImpl functionTypeAlias(
           Comment? comment,
           List<Annotation>? metadata,
@@ -748,7 +684,6 @@
           parameters as FormalParameterListImpl,
           semicolon);
 
-  @override
   FunctionTypedFormalParameterImpl functionTypedFormalParameter2(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -770,7 +705,6 @@
           parameters as FormalParameterListImpl,
           question);
 
-  @override
   GenericFunctionTypeImpl genericFunctionType(
           TypeAnnotation? returnType,
           Token functionKeyword,
@@ -784,7 +718,6 @@
           parameters as FormalParameterListImpl,
           question: question);
 
-  @override
   GenericTypeAliasImpl genericTypeAlias(
           Comment? comment,
           List<Annotation>? metadata,
@@ -804,18 +737,15 @@
           type as TypeAnnotationImpl,
           semicolon);
 
-  @override
   HideClauseImpl hideClause(
           {required Token hideKeyword,
           required List<ShowHideClauseElement> elements}) =>
       HideClauseImpl(hideKeyword, elements);
 
-  @override
   HideCombinatorImpl hideCombinator(
           Token keyword, List<SimpleIdentifier> hiddenNames) =>
       HideCombinatorImpl(keyword, hiddenNames);
 
-  @override
   IfElementImpl ifElement(
           {required Token ifKeyword,
           required Token leftParenthesis,
@@ -833,7 +763,6 @@
           elseKeyword,
           elseElement as CollectionElementImpl?);
 
-  @override
   IfStatementImpl ifStatement(
           Token ifKeyword,
           Token leftParenthesis,
@@ -851,12 +780,10 @@
           elseKeyword,
           elseStatement as StatementImpl?);
 
-  @override
   ImplementsClauseImpl implementsClause(
           Token implementsKeyword, List<NamedType> interfaces) =>
       ImplementsClauseImpl(implementsKeyword, interfaces);
 
-  @override
   ImplicitCallReferenceImpl implicitCallReference({
     required Expression expression,
     required MethodElement staticElement,
@@ -868,7 +795,6 @@
           typeArguments: typeArguments as TypeArgumentListImpl?,
           typeArgumentTypes: typeArgumentTypes);
 
-  @override
   ImportDirectiveImpl importDirective(
           Comment? comment,
           List<Annotation>? metadata,
@@ -894,7 +820,6 @@
           combinators,
           semicolon);
 
-  @override
   IndexExpressionImpl indexExpressionForCascade2(
           {required Token period,
           Token? question,
@@ -904,7 +829,6 @@
       IndexExpressionImpl.forCascade(
           period, question, leftBracket, index as ExpressionImpl, rightBracket);
 
-  @override
   IndexExpressionImpl indexExpressionForTarget2(
           {required Expression target,
           Token? question,
@@ -914,7 +838,6 @@
       IndexExpressionImpl.forTarget(target as ExpressionImpl, question,
           leftBracket, index as ExpressionImpl, rightBracket);
 
-  @override
   InstanceCreationExpressionImpl instanceCreationExpression(Token? keyword,
           ConstructorName constructorName, ArgumentList argumentList,
           {TypeArgumentList? typeArguments}) =>
@@ -924,36 +847,29 @@
           argumentList as ArgumentListImpl,
           typeArguments: typeArguments as TypeArgumentListImpl?);
 
-  @override
   IntegerLiteralImpl integerLiteral(Token literal, int? value) =>
       IntegerLiteralImpl(literal, value);
 
-  @override
   InterpolationExpressionImpl interpolationExpression(
           Token leftBracket, Expression expression, Token? rightBracket) =>
       InterpolationExpressionImpl(
           leftBracket, expression as ExpressionImpl, rightBracket);
 
-  @override
   InterpolationStringImpl interpolationString(Token contents, String value) =>
       InterpolationStringImpl(contents, value);
 
-  @override
   IsExpressionImpl isExpression(Expression expression, Token isOperator,
           Token? notOperator, TypeAnnotation type) =>
       IsExpressionImpl(expression as ExpressionImpl, isOperator, notOperator,
           type as TypeAnnotationImpl);
 
-  @override
   LabelImpl label(SimpleIdentifier label, Token colon) =>
       LabelImpl(label as SimpleIdentifierImpl, colon);
 
-  @override
   LabeledStatementImpl labeledStatement(
           List<Label> labels, Statement statement) =>
       LabeledStatementImpl(labels, statement as StatementImpl);
 
-  @override
   LibraryDirectiveImpl libraryDirective(
           Comment? comment,
           List<Annotation>? metadata,
@@ -963,11 +879,9 @@
       LibraryDirectiveImpl(comment as CommentImpl?, metadata, libraryKeyword,
           name as LibraryIdentifierImpl, semicolon);
 
-  @override
   LibraryIdentifierImpl libraryIdentifier(List<SimpleIdentifier> components) =>
       LibraryIdentifierImpl(components);
 
-  @override
   ListLiteralImpl listLiteral(
       Token? constKeyword,
       TypeArgumentList? typeArguments,
@@ -990,13 +904,11 @@
         rightBracket);
   }
 
-  @override
   MapLiteralEntryImpl mapLiteralEntry(
           Expression key, Token separator, Expression value) =>
       MapLiteralEntryImpl(
           key as ExpressionImpl, separator, value as ExpressionImpl);
 
-  @override
   MethodDeclarationImpl methodDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1022,7 +934,6 @@
           parameters as FormalParameterListImpl?,
           body as FunctionBodyImpl);
 
-  @override
   MethodInvocationImpl methodInvocation(
           Expression? target,
           Token? operator,
@@ -1036,7 +947,6 @@
           typeArguments as TypeArgumentListImpl?,
           argumentList as ArgumentListImpl);
 
-  @override
   MixinDeclarationImpl mixinDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1062,11 +972,9 @@
           members,
           rightBracket);
 
-  @override
   NamedExpressionImpl namedExpression(Label name, Expression expression) =>
       NamedExpressionImpl(name as LabelImpl, expression as ExpressionImpl);
 
-  @override
   NamedTypeImpl namedType({
     required Identifier name,
     TypeArgumentList? typeArguments,
@@ -1076,41 +984,33 @@
           name as IdentifierImpl, typeArguments as TypeArgumentListImpl?,
           question: question);
 
-  @override
   NativeClauseImpl nativeClause(Token nativeKeyword, StringLiteral? name) =>
       NativeClauseImpl(nativeKeyword, name as StringLiteralImpl?);
 
-  @override
   NativeFunctionBodyImpl nativeFunctionBody(
           Token nativeKeyword, StringLiteral? stringLiteral, Token semicolon) =>
       NativeFunctionBodyImpl(
           nativeKeyword, stringLiteral as StringLiteralImpl?, semicolon);
 
-  @override
   NodeListImpl<E> nodeList<E extends AstNode>(AstNode owner) =>
       NodeListImpl<E>(owner as AstNodeImpl);
 
-  @override
   NullLiteralImpl nullLiteral(Token literal) => NullLiteralImpl(literal);
 
-  @override
   OnClauseImpl onClause(
           Token onKeyword, List<NamedType> superclassConstraints) =>
       OnClauseImpl(onKeyword, superclassConstraints);
 
-  @override
   ParenthesizedExpressionImpl parenthesizedExpression(Token leftParenthesis,
           Expression expression, Token rightParenthesis) =>
       ParenthesizedExpressionImpl(
           leftParenthesis, expression as ExpressionImpl, rightParenthesis);
 
-  @override
   PartDirectiveImpl partDirective(Comment? comment, List<Annotation>? metadata,
           Token partKeyword, StringLiteral partUri, Token semicolon) =>
       PartDirectiveImpl(comment as CommentImpl?, metadata, partKeyword,
           partUri as StringLiteralImpl, semicolon);
 
-  @override
   PartOfDirectiveImpl partOfDirective(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1128,27 +1028,22 @@
           libraryName as LibraryIdentifierImpl?,
           semicolon);
 
-  @override
   PostfixExpressionImpl postfixExpression(Expression operand, Token operator) =>
       PostfixExpressionImpl(operand as ExpressionImpl, operator);
 
-  @override
   PrefixedIdentifierImpl prefixedIdentifier(
           SimpleIdentifier prefix, Token period, SimpleIdentifier identifier) =>
       PrefixedIdentifierImpl(prefix as SimpleIdentifierImpl, period,
           identifier as SimpleIdentifierImpl);
 
-  @override
   PrefixExpressionImpl prefixExpression(Token operator, Expression operand) =>
       PrefixExpressionImpl(operator, operand as ExpressionImpl);
 
-  @override
   PropertyAccessImpl propertyAccess(
           Expression? target, Token operator, SimpleIdentifier propertyName) =>
       PropertyAccessImpl(target as ExpressionImpl?, operator,
           propertyName as SimpleIdentifierImpl);
 
-  @override
   RedirectingConstructorInvocationImpl redirectingConstructorInvocation(
           Token thisKeyword,
           Token? period,
@@ -1160,20 +1055,16 @@
           constructorName as SimpleIdentifierImpl?,
           argumentList as ArgumentListImpl);
 
-  @override
   RethrowExpressionImpl rethrowExpression(Token rethrowKeyword) =>
       RethrowExpressionImpl(rethrowKeyword);
 
-  @override
   ReturnStatementImpl returnStatement(
           Token returnKeyword, Expression? expression, Token semicolon) =>
       ReturnStatementImpl(
           returnKeyword, expression as ExpressionImpl?, semicolon);
 
-  @override
   ScriptTagImpl scriptTag(Token scriptTag) => ScriptTagImpl(scriptTag);
 
-  @override
   SetOrMapLiteralImpl setOrMapLiteral(
           {Token? constKeyword,
           TypeArgumentList? typeArguments,
@@ -1183,23 +1074,19 @@
       SetOrMapLiteralImpl(constKeyword, typeArguments as TypeArgumentListImpl?,
           leftBracket, elements, rightBracket);
 
-  @override
   ShowClauseImpl showClause(
           {required Token showKeyword,
           required List<ShowHideClauseElement> elements}) =>
       ShowClauseImpl(showKeyword, elements);
 
-  @override
   ShowCombinatorImpl showCombinator(
           Token keyword, List<SimpleIdentifier> shownNames) =>
       ShowCombinatorImpl(keyword, shownNames);
 
-  @override
   ShowHideElementImpl showHideElement(
           {required Token? modifier, required SimpleIdentifier name}) =>
       ShowHideElementImpl(modifier, name);
 
-  @override
   SimpleFormalParameterImpl simpleFormalParameter2(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -1217,7 +1104,6 @@
           type as TypeAnnotationImpl?,
           identifier as SimpleIdentifierImpl?);
 
-  @override
   SimpleIdentifierImpl simpleIdentifier(Token token,
       {bool isDeclaration = false}) {
     if (isDeclaration) {
@@ -1226,21 +1112,17 @@
     return SimpleIdentifierImpl(token);
   }
 
-  @override
   SimpleStringLiteralImpl simpleStringLiteral(Token literal, String value) =>
       SimpleStringLiteralImpl(literal, value);
 
-  @override
   SpreadElementImpl spreadElement(
           {required Token spreadOperator, required Expression expression}) =>
       SpreadElementImpl(spreadOperator, expression as ExpressionImpl);
 
-  @override
   StringInterpolationImpl stringInterpolation(
           List<InterpolationElement> elements) =>
       StringInterpolationImpl(elements);
 
-  @override
   SuperConstructorInvocationImpl superConstructorInvocation(
           Token superKeyword,
           Token? period,
@@ -1252,11 +1134,9 @@
           constructorName as SimpleIdentifierImpl?,
           argumentList as ArgumentListImpl);
 
-  @override
   SuperExpressionImpl superExpression(Token superKeyword) =>
       SuperExpressionImpl(superKeyword);
 
-  @override
   SuperFormalParameterImpl superFormalParameter(
           {Comment? comment,
           List<Annotation>? metadata,
@@ -1284,18 +1164,15 @@
           parameters as FormalParameterListImpl?,
           question);
 
-  @override
   SwitchCaseImpl switchCase(List<Label> labels, Token keyword,
           Expression expression, Token colon, List<Statement> statements) =>
       SwitchCaseImpl(
           labels, keyword, expression as ExpressionImpl, colon, statements);
 
-  @override
   SwitchDefaultImpl switchDefault(List<Label> labels, Token keyword,
           Token colon, List<Statement> statements) =>
       SwitchDefaultImpl(labels, keyword, colon, statements);
 
-  @override
   SwitchStatementImpl switchStatement(
           Token switchKeyword,
           Token leftParenthesis,
@@ -1313,20 +1190,16 @@
           members,
           rightBracket);
 
-  @override
   SymbolLiteralImpl symbolLiteral(Token poundSign, List<Token> components) =>
       SymbolLiteralImpl(poundSign, components);
 
-  @override
   ThisExpressionImpl thisExpression(Token thisKeyword) =>
       ThisExpressionImpl(thisKeyword);
 
-  @override
   ThrowExpressionImpl throwExpression(
           Token throwKeyword, Expression expression) =>
       ThrowExpressionImpl(throwKeyword, expression as ExpressionImpl);
 
-  @override
   TopLevelVariableDeclarationImpl topLevelVariableDeclaration(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1340,7 +1213,6 @@
           variableList as VariableDeclarationListImpl,
           semicolon);
 
-  @override
   TryStatementImpl tryStatement(
           Token tryKeyword,
           Block body,
@@ -1350,16 +1222,13 @@
       TryStatementImpl(tryKeyword, body as BlockImpl, catchClauses,
           finallyKeyword, finallyBlock as BlockImpl?);
 
-  @override
   TypeArgumentListImpl typeArgumentList(Token leftBracket,
           List<TypeAnnotation> arguments, Token rightBracket) =>
       TypeArgumentListImpl(leftBracket, arguments, rightBracket);
 
-  @override
   TypeLiteralImpl typeLiteral({required NamedType typeName}) =>
       TypeLiteralImpl(typeName as NamedTypeImpl);
 
-  @override
   TypeParameterImpl typeParameter(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1388,18 +1257,15 @@
           bound as TypeAnnotationImpl?)
         ..varianceKeyword = varianceKeyword;
 
-  @override
   TypeParameterListImpl typeParameterList(Token leftBracket,
           List<TypeParameter> typeParameters, Token rightBracket) =>
       TypeParameterListImpl(leftBracket, typeParameters, rightBracket);
 
-  @override
   VariableDeclarationImpl variableDeclaration(
           SimpleIdentifier name, Token? equals, Expression? initializer) =>
       VariableDeclarationImpl(
           name as SimpleIdentifierImpl, equals, initializer as ExpressionImpl?);
 
-  @override
   VariableDeclarationListImpl variableDeclarationList(
           Comment? comment,
           List<Annotation>? metadata,
@@ -1409,7 +1275,6 @@
       VariableDeclarationListImpl(comment as CommentImpl?, metadata, null,
           keyword, type as TypeAnnotationImpl?, variables);
 
-  @override
   VariableDeclarationListImpl variableDeclarationList2(
       {Comment? comment,
       List<Annotation>? metadata,
@@ -1421,23 +1286,19 @@
         lateKeyword, keyword, type as TypeAnnotationImpl?, variables);
   }
 
-  @override
   VariableDeclarationStatementImpl variableDeclarationStatement(
           VariableDeclarationList variableList, Token semicolon) =>
       VariableDeclarationStatementImpl(
           variableList as VariableDeclarationListImpl, semicolon);
 
-  @override
   WhileStatementImpl whileStatement(Token whileKeyword, Token leftParenthesis,
           Expression condition, Token rightParenthesis, Statement body) =>
       WhileStatementImpl(whileKeyword, leftParenthesis,
           condition as ExpressionImpl, rightParenthesis, body as StatementImpl);
 
-  @override
   WithClauseImpl withClause(Token withKeyword, List<NamedType> mixinTypes) =>
       WithClauseImpl(withKeyword, mixinTypes);
 
-  @override
   YieldStatementImpl yieldStatement(Token yieldKeyword, Token? star,
           Expression expression, Token semicolon) =>
       YieldStatementImpl(
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index ce089032..d6f24f4 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1116,18 +1116,6 @@
   @override
   int get hashCode => source.hashCode;
 
-  @Deprecated('Not useful for clients')
-  @override
-  bool get hasLoadLibraryFunction {
-    final functions = this.functions;
-    for (int i = 0; i < functions.length; i++) {
-      if (functions[i].name == FunctionElement.LOAD_LIBRARY_NAME) {
-        return true;
-      }
-    }
-    return false;
-  }
-
   @override
   String get identifier => '${source.uri}';
 
@@ -1186,12 +1174,6 @@
   @override
   TypeParameterizedElementMixin? get typeParameterContext => null;
 
-  @Deprecated('Use classes instead')
-  @override
-  List<ClassElement> get types {
-    return _classes;
-  }
-
   @override
   bool operator ==(Object other) =>
       other is CompilationUnitElementImpl && source == other.source;
@@ -3560,10 +3542,6 @@
         NamespaceBuilder().createImportNamespaceForDirective(this);
   }
 
-  @Deprecated('Use prefix.nameOffset instead')
-  @override
-  int get prefixOffset => prefix?.nameOffset ?? -1;
-
   @override
   T? accept<T>(ElementVisitor<T> visitor) => visitor.visitImportElement(this);
 
@@ -3775,21 +3753,6 @@
     return _exports;
   }
 
-  @Deprecated('Support for dart-ext is replaced with FFI')
-  @override
-  bool get hasExtUri => false;
-
-  @Deprecated('Not useful for clients')
-  @override
-  bool get hasLoadLibraryFunction {
-    for (int i = 0; i < units.length; i++) {
-      if (units[i].hasLoadLibraryFunction) {
-        return true;
-      }
-    }
-    return false;
-  }
-
   bool get hasPartOfDirective {
     return hasModifier(Modifier.HAS_PART_OF_DIRECTIVE);
   }
diff --git a/pkg/analyzer/lib/src/dart/micro/analysis_context.dart b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
index 715bba0..02c0dcd 100644
--- a/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
+++ b/pkg/analyzer/lib/src/dart/micro/analysis_context.dart
@@ -19,7 +19,6 @@
 import 'package:analyzer/src/dart/micro/resolve_file.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/workspace/workspace.dart';
 
 MicroContextObjects createMicroContextObjects({
   required FileResolver fileResolver,
@@ -138,12 +137,6 @@
   @override
   Folder? get sdkRoot => null;
 
-  @Deprecated('Use contextRoot.workspace instead')
-  @override
-  Workspace get workspace {
-    return contextRoot.workspace;
-  }
-
   @override
   dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 }
diff --git a/pkg/analyzer/lib/src/file_system/file_system.dart b/pkg/analyzer/lib/src/file_system/file_system.dart
index d7bfadf..89b0868 100644
--- a/pkg/analyzer/lib/src/file_system/file_system.dart
+++ b/pkg/analyzer/lib/src/file_system/file_system.dart
@@ -32,10 +32,6 @@
     return file.createSource(uri);
   }
 
-  @Deprecated('Use pathToUri() instead')
-  @override
-  Uri restoreAbsolute(Source source) => pathToUri(source.fullName);
-
   /// Return `true` if the given [uri] is a `file` URI.
   static bool isFileUri(Uri uri) => uri.isScheme(FILE_SCHEME);
 }
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index eb6df5c..db1a627 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -319,7 +319,6 @@
     _lintRules = rules;
   }
 
-  @override
   Uint32List get signature {
     if (_signature == null) {
       ApiSignature buffer = ApiSignature();
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index 48a0c91..80af1a5 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -19,20 +19,12 @@
 
   BasicSource(this.uri);
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => uri.toString();
-
   @override
   String get fullName => '$uri';
 
   @override
   int get hashCode => uri.hashCode;
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary => uri.isScheme('dart');
-
   @override
   String get shortName => pathos.basename(fullName);
 
@@ -97,30 +89,12 @@
     throw UnsupportedError('$fullName does not exist.');
   }
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => uri.toString();
-
   @override
   int get hashCode => fullName.hashCode;
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary => false;
-
-  @Deprecated('Not used anymore')
-  @override
-  int get modificationStamp => -1;
-
   @override
   String get shortName => pathos.basename(fullName);
 
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind {
-    return UriKind.FILE_URI;
-  }
-
   @override
   bool operator ==(Object other) {
     if (other is NonExistingSource) {
@@ -169,14 +143,6 @@
   /// @throws Exception if the contents of this source could not be accessed
   TimestampedData<String> get contents;
 
-  /// Return an encoded representation of this source that can be used to create
-  /// a source that is equal to this source.
-  ///
-  /// @return an encoded representation of this source
-  /// See [SourceFactory.fromEncoding].
-  @Deprecated('Not used anymore')
-  String get encoding;
-
   /// Return the full (long) version of the name that can be displayed to the
   /// user to denote this source. For example, for a source representing a file
   /// this would typically be the absolute path of the file.
@@ -191,26 +157,6 @@
   @override
   int get hashCode;
 
-  /// Return `true` if this source is in one of the system libraries.
-  ///
-  /// @return `true` if this is in a system library
-  @Deprecated('Use uri.isScheme("dart") instead')
-  bool get isInSystemLibrary;
-
-  /// Return the modification stamp for this source, or a negative value if the
-  /// source does not exist. A modification stamp is a non-negative integer with
-  /// the property that if the contents of the source have not been modified
-  /// since the last time the modification stamp was accessed then the same
-  /// value will be returned, but if the contents of the source have been
-  /// modified one or more times (even if the net change is zero) the stamps
-  /// will be different.
-  ///
-  /// Clients should consider using the method
-  /// [AnalysisContext.getModificationStamp] because contexts can have local
-  /// overrides of the content of a source that the source is not aware of.
-  @Deprecated('Not used anymore')
-  int get modificationStamp;
-
   /// Return a short version of the name that can be displayed to the user to
   /// denote this source. For example, for a source representing a file this
   /// would typically be the name of the file.
@@ -223,16 +169,6 @@
   /// @return the URI from which this source was originally derived
   Uri get uri;
 
-  /// Return the kind of URI from which this source was originally derived. If
-  /// this source was created from an absolute URI, then the returned kind will
-  /// reflect the scheme of the absolute URI. If it was created from a relative
-  /// URI, then the returned kind will be the same as the kind of the source
-  /// against which the relative URI was resolved.
-  ///
-  /// @return the kind of URI from which this source was originally derived
-  @Deprecated('Use Source.uri instead')
-  UriKind get uriKind;
-
   /// Return `true` if the given object is a source that represents the same
   /// source code as this source.
   ///
@@ -299,14 +235,6 @@
   /// if either the [containedUri] is invalid or if it cannot be resolved
   /// against the [containingSource]'s URI.
   Source? resolveUri(Source? containingSource, String? containedUri);
-
-  /// Return an absolute URI that represents the given source, or `null` if a
-  /// valid URI cannot be computed.
-  ///
-  /// @param source the source to get URI for
-  /// @return the absolute URI representing the given source
-  @Deprecated('Use pathToUri() instead')
-  Uri? restoreUri(Source source);
 }
 
 /// The enumeration `SourceKind` defines the different kinds of sources that are
@@ -350,72 +278,6 @@
   String toString() => name;
 }
 
-/// The enumeration `UriKind` defines the different kinds of URI's that are
-/// known to the analysis engine. These are used to keep track of the kind of
-/// URI associated with a given source.
-@Deprecated('Use Source.uri instead')
-class UriKind implements Comparable<UriKind> {
-  /// A 'dart:' URI.
-  static const UriKind DART_URI = UriKind('DART_URI', 0, 0x64);
-
-  /// A 'file:' URI.
-  static const UriKind FILE_URI = UriKind('FILE_URI', 1, 0x66);
-
-  /// A 'package:' URI.
-  static const UriKind PACKAGE_URI = UriKind('PACKAGE_URI', 2, 0x70);
-
-  static const List<UriKind> values = [DART_URI, FILE_URI, PACKAGE_URI];
-
-  /// The name of this URI kind.
-  final String name;
-
-  /// The ordinal value of the URI kind.
-  final int ordinal;
-
-  /// The single character encoding used to identify this kind of URI.
-  final int encoding;
-
-  /// Initialize a newly created URI kind to have the given encoding.
-  const UriKind(this.name, this.ordinal, this.encoding);
-
-  @override
-  int get hashCode => ordinal;
-
-  @override
-  int compareTo(UriKind other) => ordinal - other.ordinal;
-
-  @override
-  String toString() => name;
-
-  /// Return the URI kind represented by the given [encoding], or `null` if
-  /// there is no kind with the given encoding.
-  static UriKind? fromEncoding(int encoding) {
-    while (true) {
-      if (encoding == 0x64) {
-        return DART_URI;
-      } else if (encoding == 0x66) {
-        return FILE_URI;
-      } else if (encoding == 0x70) {
-        return PACKAGE_URI;
-      }
-      break;
-    }
-    return null;
-  }
-
-  /// Return the URI kind corresponding to the given scheme string.
-  static UriKind fromScheme(String scheme) {
-    if (scheme == 'package') {
-      return UriKind.PACKAGE_URI;
-    } else if (scheme == 'dart') {
-      return UriKind.DART_URI;
-    } else if (scheme == 'file') {
-      return UriKind.FILE_URI;
-    }
-    return UriKind.FILE_URI;
-  }
-}
-
 /// The abstract class `UriResolver` defines the behavior of objects that are
 /// used to resolve URI's for a source factory. Subclasses of this class are
 /// expected to resolve a single scheme of absolute URI.
@@ -425,33 +287,10 @@
   /// The file at that path is not required to exist.
   ///
   /// Throws an [ArgumentError] if the [path] is not a valid path.
-  /// ignore: deprecated_member_use_from_same_package
-  Uri? pathToUri(String path) => restoreAbsolute(_FakeSource(path));
+  Uri? pathToUri(String path);
 
   /// Resolve the given absolute [uri]. Return a [Source] representing the file
   /// to which it was resolved, whether or not the resulting source exists, or
   /// `null` if it could not be resolved because the URI is invalid.
   Source? resolveAbsolute(Uri uri);
-
-  /// Return an absolute URI that represents the given [source], or `null` if a
-  /// valid URI cannot be computed.
-  ///
-  /// The computation should be based solely on [source.fullName].
-  @Deprecated('Use pathToUri() instead')
-  Uri? restoreAbsolute(Source source) {
-    return pathToUri(source.fullName);
-  }
-}
-
-class _FakeSource implements Source {
-  @override
-  final String fullName;
-
-  _FakeSource(this.fullName);
-
-  @override
-  Uri get uri => pathos.toUri(fullName);
-
-  @override
-  dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 }
diff --git a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
index 9005be7..a8bc5df 100644
--- a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
+++ b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
@@ -55,10 +55,6 @@
 
   _MockSource(this.uri);
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => '$uri';
-
   @override
   String get fullName => uri.path;
 
diff --git a/pkg/analyzer/lib/src/source/source_resource.dart b/pkg/analyzer/lib/src/source/source_resource.dart
index 275165b..cb4a5ee 100644
--- a/pkg/analyzer/lib/src/source/source_resource.dart
+++ b/pkg/analyzer/lib/src/source/source_resource.dart
@@ -38,9 +38,6 @@
   /// The cached absolute path of this source.
   String? _absolutePath;
 
-  /// The cached encoding for this source.
-  String? _encoding;
-
   /// Initialize a newly created source object to represent the given [file]. If
   /// a [uri] is given, then it will be used as the URI from which the source
   /// was derived, otherwise a `file:` URI will be created based on the [file].
@@ -67,37 +64,15 @@
         file.modificationStamp, fileReadMode(file.readAsStringSync()));
   }
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => _encoding ??= uri.toString();
-
   @override
   String get fullName => _absolutePath ??= file.path;
 
   @override
   int get hashCode => uri.hashCode;
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary => uri.isScheme(DartUriResolver.DART_SCHEME);
-
-  @Deprecated('Not used anymore')
-  @override
-  int get modificationStamp {
-    try {
-      return file.modificationStamp;
-    } on FileSystemException {
-      return -1;
-    }
-  }
-
   @override
   String get shortName => file.shortName;
 
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind => UriKind.fromScheme(uri.scheme);
-
   @override
   bool operator ==(Object other) {
     if (other is FileSource) {
diff --git a/pkg/analyzer/lib/src/string_source.dart b/pkg/analyzer/lib/src/string_source.dart
index a8e55db..e1e16d8 100644
--- a/pkg/analyzer/lib/src/string_source.dart
+++ b/pkg/analyzer/lib/src/string_source.dart
@@ -17,36 +17,19 @@
   @override
   final Uri uri;
 
-  @override
-  final int modificationStamp;
-
   StringSource(this._contents, String? fullName, {Uri? uri})
       : fullName = fullName ?? '/test.dart',
-        uri = _computeUri(uri, fullName),
-        modificationStamp = DateTime.now().millisecondsSinceEpoch;
+        uri = _computeUri(uri, fullName);
 
   @override
-  TimestampedData<String> get contents =>
-      TimestampedData(modificationStamp, _contents);
-
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => uri.toString();
+  TimestampedData<String> get contents => TimestampedData(0, _contents);
 
   @override
   int get hashCode => _contents.hashCode ^ fullName.hashCode;
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary => false;
-
   @override
   String get shortName => fullName;
 
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind => UriKind.FILE_URI;
-
   /// Return `true` if the given [object] is a string source that is equal to
   /// this source.
   @override
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index 635bb96..490ebef 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -70,14 +70,6 @@
   @override
   TimestampedData<String> get contents => TimestampedData<String>(0, '');
 
-  @Deprecated('Not used anymore')
-  @override
-  int get modificationStamp => 0;
-
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind => UriKind.PACKAGE_URI;
-
   @override
   bool exists() => true;
 
diff --git a/pkg/analyzer/lib/src/summary2/link.dart b/pkg/analyzer/lib/src/summary2/link.dart
index af9b7da..8cd98a7 100644
--- a/pkg/analyzer/lib/src/summary2/link.dart
+++ b/pkg/analyzer/lib/src/summary2/link.dart
@@ -26,19 +26,6 @@
 var timerLinkingLinkingBundle = Stopwatch();
 
 /// Note that AST units and tokens of [inputLibraries] will be damaged.
-@Deprecated('Use link2() instead')
-LinkResult link(
-  LinkedElementFactory elementFactory,
-  List<LinkInputLibrary> inputLibraries,
-) {
-  var linker = Linker(elementFactory);
-  linker.link(inputLibraries);
-  return LinkResult(
-    resolutionBytes: linker.resolutionBytes,
-  );
-}
-
-/// Note that AST units and tokens of [inputLibraries] will be damaged.
 Future<LinkResult> link2(
   LinkedElementFactory elementFactory,
   List<LinkInputLibrary> inputLibraries,
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 86abb1d..ae91994 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
 name: analyzer
-version: 3.4.1
+version: 4.0.0-dev
 description: This package provides a library that performs static analysis of Dart code.
 homepage: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
 
diff --git a/pkg/analyzer/test/file_system/memory_file_system_test.dart b/pkg/analyzer/test/file_system/memory_file_system_test.dart
index ffb9e0d..92dfe23 100644
--- a/pkg/analyzer/test/file_system/memory_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/memory_file_system_test.dart
@@ -216,11 +216,6 @@
     expect(source.fullName, sourcePath);
   }
 
-  @Deprecated('Not used anymore')
-  test_modificationStamp() {
-    expect(source.modificationStamp, -1);
-  }
-
   test_resolveRelative() {
     Uri relative = resolveRelativeUri(
         source.uri,
diff --git a/pkg/analyzer/test/file_system/resource_uri_resolver_test.dart b/pkg/analyzer/test/file_system/resource_uri_resolver_test.dart
index a34d548..3adf09b 100644
--- a/pkg/analyzer/test/file_system/resource_uri_resolver_test.dart
+++ b/pkg/analyzer/test/file_system/resource_uri_resolver_test.dart
@@ -3,7 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/src/file_system/file_system.dart';
-import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -64,16 +63,4 @@
     var source = resolver.resolveAbsolute(uri);
     expect(source, isNull);
   }
-
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute() {
-    var uri = toUri('/test.dart');
-
-    var source = resolver.resolveAbsolute(uri)!;
-    expect(resolver.restoreAbsolute(source), uri);
-    expect(
-        resolver.restoreAbsolute(
-            NonExistingSource(source.fullName, Uri.parse('dart:math'))),
-        uri);
-  }
 }
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 2b959b8..fa2e7de 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -17,7 +17,6 @@
     defineReflectiveTests(DartUriResolverTest);
     defineReflectiveTests(ErrorSeverityTest);
     defineReflectiveTests(ResolveRelativeUriTest);
-    defineReflectiveTests(UriKindTest);
   });
 }
 
@@ -72,22 +71,6 @@
     var result = resolver.resolveAbsolute(Uri.parse("package:some/file.dart"));
     expect(result, isNull);
   }
-
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute_library() {
-    _SourceMock source = _SourceMock();
-    source.fullName = convertPath('/sdk/lib/core/core.dart');
-    var dartUri = resolver.restoreAbsolute(source);
-    expect(dartUri.toString(), 'dart:core');
-  }
-
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute_part() {
-    _SourceMock source = _SourceMock();
-    source.fullName = convertPath('/sdk/lib/core/int.dart');
-    var dartUri = resolver.restoreAbsolute(source);
-    expect(dartUri.toString(), 'dart:core/int.dart');
-  }
 }
 
 @reflectiveTest
@@ -191,24 +174,6 @@
   }
 }
 
-@reflectiveTest
-class UriKindTest {
-  @deprecated
-  test_fromEncoding() async {
-    expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI));
-    expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI));
-    expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
-    expect(UriKind.fromEncoding(0x58), isNull);
-  }
-
-  @deprecated
-  test_getEncoding() async {
-    expect(UriKind.DART_URI.encoding, 0x64);
-    expect(UriKind.FILE_URI.encoding, 0x66);
-    expect(UriKind.PACKAGE_URI.encoding, 0x70);
-  }
-}
-
 class _SimpleDartSdkTest with ResourceProviderMixin {
   late final DartSdk sdk;
 
@@ -232,16 +197,3 @@
     sdk = FolderBasedDartSdk(resourceProvider, sdkFolder);
   }
 }
-
-class _SourceMock implements Source {
-  @override
-  late final String fullName;
-
-  @override
-  late final Uri uri;
-
-  @override
-  noSuchMethod(Invocation invocation) {
-    throw StateError('Unexpected invocation of ${invocation.memberName}');
-  }
-}
diff --git a/pkg/analyzer/test/generated/source_factory_test.dart b/pkg/analyzer/test/generated/source_factory_test.dart
index f13f48d..fb01823 100644
--- a/pkg/analyzer/test/generated/source_factory_test.dart
+++ b/pkg/analyzer/test/generated/source_factory_test.dart
@@ -12,8 +12,6 @@
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import 'test_support.dart';
-
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(SourceFactoryTest);
@@ -26,6 +24,11 @@
   AbsoluteUriResolver(this.resourceProvider);
 
   @override
+  Uri? pathToUri(String path) {
+    throw UnimplementedError();
+  }
+
+  @override
   Source resolveAbsolute(Uri uri) {
     return FileSource(
         resourceProvider.getFile(resourceProvider.pathContext.fromUri(uri)),
@@ -104,19 +107,6 @@
     expect(result.fullName, secondPath);
     expect(result.uri.toString(), 'package:package/dir/second.dart');
   }
-
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreUri() {
-    File file1 = getFile("/some/file1.dart");
-    File file2 = getFile("/some/file2.dart");
-    Source source1 = FileSource(file1);
-    Source source2 = FileSource(file2);
-    Uri expected1 = Uri.parse("file:///my_file.dart");
-    SourceFactory factory =
-        SourceFactory([UriResolver_restoreUri(file1.path, expected1)]);
-    expect(factory.restoreUri(source1), same(expected1));
-    expect(factory.restoreUri(source2), isNull);
-  }
 }
 
 class UriResolver_absolute extends UriResolver {
@@ -125,6 +115,11 @@
   UriResolver_absolute();
 
   @override
+  Uri? pathToUri(String path) {
+    throw UnimplementedError();
+  }
+
+  @override
   Source? resolveAbsolute(Uri uri) {
     invoked = true;
     return null;
@@ -147,17 +142,3 @@
   @override
   Source? resolveAbsolute(Uri uri) => null;
 }
-
-class UriResolver_SourceFactoryTest_test_fromEncoding_valid
-    extends UriResolver {
-  String encoding;
-  UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding);
-
-  @override
-  Source? resolveAbsolute(Uri uri) {
-    if (uri.toString() == encoding) {
-      return TestSource();
-    }
-    return null;
-  }
-}
diff --git a/pkg/analyzer/test/generated/test_analysis_context.dart b/pkg/analyzer/test/generated/test_analysis_context.dart
index 7d5eae6..fb38dea 100644
--- a/pkg/analyzer/test/generated/test_analysis_context.dart
+++ b/pkg/analyzer/test/generated/test_analysis_context.dart
@@ -107,10 +107,6 @@
 
   _MockSource(this.uri);
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => '$uri';
-
   @override
   noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 }
diff --git a/pkg/analyzer/test/generated/test_support.dart b/pkg/analyzer/test/generated/test_support.dart
index e2f886f..ecb95c0 100644
--- a/pkg/analyzer/test/generated/test_support.dart
+++ b/pkg/analyzer/test/generated/test_support.dart
@@ -435,7 +435,6 @@
 class TestSource extends Source {
   final String _name;
   String _contents;
-  int _modificationStamp = 0;
   bool exists2 = true;
 
   /// A flag indicating whether an exception should be generated when an attempt
@@ -457,10 +456,6 @@
     return TimestampedData<String>(0, _contents);
   }
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => _name;
-
   @override
   String get fullName {
     return _name;
@@ -469,17 +464,6 @@
   @override
   int get hashCode => 0;
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary {
-    return false;
-  }
-
-  @Deprecated('Not used anymore')
-  @override
-  int get modificationStamp =>
-      generateExceptionOnRead ? -1 : _modificationStamp;
-
   @override
   String get shortName {
     return _name;
@@ -488,12 +472,6 @@
   @override
   Uri get uri => Uri.file(_name);
 
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind {
-    throw UnsupportedError('uriKind');
-  }
-
   @override
   bool operator ==(Object other) {
     if (other is TestSource) {
@@ -511,7 +489,6 @@
 
   void setContents(String value) {
     generateExceptionOnRead = false;
-    _modificationStamp = DateTime.now().millisecondsSinceEpoch;
     _contents = value;
   }
 
@@ -526,21 +503,6 @@
   TestSourceWithUri(String path, this.uri, [String content = ''])
       : super(path, content);
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => uri.toString();
-
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind {
-    if (uri.isScheme('dart')) {
-      return UriKind.DART_URI;
-    } else if (uri.isScheme('package')) {
-      return UriKind.PACKAGE_URI;
-    }
-    return UriKind.FILE_URI;
-  }
-
   @override
   bool operator ==(Object other) {
     if (other is TestSource) {
diff --git a/pkg/analyzer/test/source/package_map_resolver_test.dart b/pkg/analyzer/test/source/package_map_resolver_test.dart
index 5498a6d..36c608e 100644
--- a/pkg/analyzer/test/source/package_map_resolver_test.dart
+++ b/pkg/analyzer/test/source/package_map_resolver_test.dart
@@ -6,7 +6,6 @@
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/source/package_map_resolver.dart';
-import 'package:path/path.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -170,39 +169,4 @@
     var result = resolver.resolveAbsolute(uri);
     expect(result, isNull);
   }
-
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute() {
-    String pkgFileA = provider.convertPath('/pkgA/lib/libA.dart');
-    String pkgFileB = provider.convertPath('/pkgB/lib/src/libB.dart');
-    provider.newFile(pkgFileA, 'library lib_a;');
-    provider.newFile(pkgFileB, 'library lib_b;');
-    PackageMapUriResolver resolver =
-        PackageMapUriResolver(provider, <String, List<Folder>>{
-      'pkgA': <Folder>[provider.getFolder(provider.convertPath('/pkgA/lib'))],
-      'pkgB': <Folder>[provider.getFolder(provider.convertPath('/pkgB/lib'))]
-    });
-    {
-      Source source =
-          _createFileSource(provider.convertPath('/pkgA/lib/libA.dart'));
-      var uri = resolver.restoreAbsolute(source)!;
-      expect(uri.toString(), 'package:pkgA/libA.dart');
-    }
-    {
-      Source source =
-          _createFileSource(provider.convertPath('/pkgB/lib/src/libB.dart'));
-      var uri = resolver.restoreAbsolute(source)!;
-      expect(uri.toString(), 'package:pkgB/src/libB.dart');
-    }
-    {
-      Source source = _createFileSource('/no/such/file');
-      var uri = resolver.restoreAbsolute(source);
-      expect(uri, isNull);
-    }
-  }
-
-  @Deprecated('Use pathToUri() instead')
-  Source _createFileSource(String path) {
-    return NonExistingSource(path, toUri(path));
-  }
 }
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 0f775f5..a5b3e67 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1521,6 +1521,9 @@
     // Notify the driver that the file was changed.
     driver.changeFile(a);
 
+    // ...and apply this change.
+    await driver.applyPendingFileChanges();
+
     // So, `class A {}` is declared now.
     expect(driver.getFileSyncValid(a).lineInfo.lineCount, 2);
     expect((await driver.getResultValid(b)).errors, isEmpty);
@@ -2475,6 +2478,9 @@
     // Notify the driver that the file was changed.
     driver.changeFile(a);
 
+    // ...and apply this change.
+    await driver.applyPendingFileChanges();
+
     // So, `class A {}` is declared now.
     {
       var parseResult = driver.parseFileSync(a) as ParsedUnitResult;
diff --git a/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart b/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
index e9b7143..61fd0a9 100644
--- a/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
@@ -574,7 +574,7 @@
     await testDriver.applyPendingFileChanges();
 
     var performance = OperationPerformanceImpl('<root>');
-    var result = testDriver.resolveForCompletion(
+    var result = await testDriver.resolveForCompletion(
       path: path,
       offset: offset,
       performance: performance,
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart
index 715ee3a..4aab65c 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -606,16 +606,6 @@
     Element element = ElementFactory.classElement2("C");
     expect(element.isPublic, isTrue);
   }
-
-  void test_SORT_BY_OFFSET() {
-    ClassElementImpl classElementA = class_(name: 'A');
-    classElementA.nameOffset = 1;
-    ClassElementImpl classElementB = ElementFactory.classElement2("B");
-    classElementB.nameOffset = 2;
-    expect(Element.SORT_BY_OFFSET(classElementA, classElementA), 0);
-    expect(Element.SORT_BY_OFFSET(classElementA, classElementB) < 0, isTrue);
-    expect(Element.SORT_BY_OFFSET(classElementB, classElementA) > 0, isTrue);
-  }
 }
 
 @reflectiveTest
diff --git a/pkg/analyzer/test/src/source/source_resource_test.dart b/pkg/analyzer/test/src/source/source_resource_test.dart
index a646957..bf69b49 100644
--- a/pkg/analyzer/test/src/source/source_resource_test.dart
+++ b/pkg/analyzer/test/src/source/source_resource_test.dart
@@ -3,13 +3,9 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/java_engine_io.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
 import 'package:analyzer/src/source/source_resource.dart';
-import 'package:analyzer/src/test_utilities/mock_sdk.dart';
 import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -83,28 +79,6 @@
     expect(source2.hashCode, source1.hashCode);
   }
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  void test_isInSystemLibrary_contagious() {
-    DartSdk sdk = _createSdk();
-    UriResolver resolver = DartUriResolver(sdk);
-    SourceFactory factory = SourceFactory([resolver]);
-    // resolve dart:core
-    Source result = resolver.resolveAbsolute(Uri.parse("dart:async"))!;
-    expect(result.isInSystemLibrary, isTrue);
-    // system libraries reference only other system libraries
-    Source partSource = factory.resolveUri(result, "stream.dart")!;
-    expect(partSource.isInSystemLibrary, isTrue);
-  }
-
-  @Deprecated('Use uri.isScheme("dart") instead')
-  void test_isInSystemLibrary_false() {
-    File file = getFile("/does/not/exist.dart");
-    FileSource source = FileSource(file);
-    expect(source, isNotNull);
-    expect(source.fullName, file.path);
-    expect(source.isInSystemLibrary, isFalse);
-  }
-
   void test_issue14500() {
     // see https://code.google.com/p/dart/issues/detail?id=14500
     FileSource source = FileSource(getFile("/some/packages/foo:bar.dart"));
@@ -163,13 +137,4 @@
     expect(source.fullName, file.path);
     expect(source.uri.toString(), 'dart:core');
   }
-
-  DartSdk _createSdk() {
-    var sdkRoot = newFolder('/sdk');
-    createMockSdk(
-      resourceProvider: resourceProvider,
-      root: sdkRoot,
-    );
-    return FolderBasedDartSdk(resourceProvider, sdkRoot);
-  }
 }
diff --git a/pkg/analyzer/test/src/workspace/bazel_test.dart b/pkg/analyzer/test/src/workspace/bazel_test.dart
index b29037d..72f96f4 100644
--- a/pkg/analyzer/test/src/workspace/bazel_test.dart
+++ b/pkg/analyzer/test/src/workspace/bazel_test.dart
@@ -149,21 +149,6 @@
     );
   }
 
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute() {
-    _addResources([
-      '/workspace/WORKSPACE',
-    ]);
-    Uri uri =
-        resourceProvider.pathContext.toUri(convertPath('/workspace/test.dart'));
-    var source = resolver.resolveAbsolute(uri)!;
-    expect(resolver.restoreAbsolute(source), uri);
-    expect(
-        resolver.restoreAbsolute(NonExistingSource(
-            source.fullName, Uri.parse('package:test/test.dart'))),
-        uri);
-  }
-
   void _addResources(List<String> paths) {
     for (String path in paths) {
       if (path.endsWith('/')) {
@@ -687,18 +672,13 @@
     // If enabled, test also "restoreAbsolute".
     if (restore) {
       expect(resolver.pathToUri(path), uri);
-      // ignore: deprecated_member_use_from_same_package
-      expect(resolver.restoreAbsolute(source), uri);
     }
   }
 
   void _assertRestore(String posixPath, String? expectedUriStr) {
     var expectedUri = expectedUriStr != null ? Uri.parse(expectedUriStr) : null;
     String path = convertPath(posixPath);
-    _MockSource source = _MockSource(path);
     expect(resolver.pathToUri(path), expectedUri);
-    // ignore: deprecated_member_use_from_same_package
-    expect(resolver.restoreAbsolute(source), expectedUri);
   }
 }
 
@@ -1238,15 +1218,3 @@
   void _expectFindFile(String path, {required String equals}) =>
       expect(workspace.findFile(convertPath(path))!.path, convertPath(equals));
 }
-
-class _MockSource implements Source {
-  @override
-  final String fullName;
-
-  _MockSource(this.fullName);
-
-  @override
-  noSuchMethod(Invocation invocation) {
-    throw StateError('Unexpected invocation of ${invocation.memberName}');
-  }
-}
diff --git a/pkg/analyzer/test/src/workspace/package_build_test.dart b/pkg/analyzer/test/src/workspace/package_build_test.dart
index 5300110..534e9de 100644
--- a/pkg/analyzer/test/src/workspace/package_build_test.dart
+++ b/pkg/analyzer/test/src/workspace/package_build_test.dart
@@ -106,19 +106,6 @@
     expect(source, isNull);
   }
 
-  @Deprecated('Use pathToUri() instead')
-  void test_restoreAbsolute() {
-    Uri uri =
-        resourceProvider.pathContext.toUri(convertPath('/workspace/test.dart'));
-    var source = resolver.resolveAbsolute(uri)!;
-    expect(source, isNotNull);
-    expect(resolver.restoreAbsolute(source), uri);
-    expect(
-        resolver.restoreAbsolute(NonExistingSource(
-            source.fullName, Uri.parse('package:test/test.dart'))),
-        uri);
-  }
-
   Source? _resolvePath(String path) {
     Uri uri = toUri(path);
     return resolver.resolveAbsolute(uri);
@@ -223,8 +210,6 @@
     // If enabled, test also "restoreAbsolute".
     if (restore) {
       expect(resolver.pathToUri(path), uri);
-      // ignore: deprecated_member_use_from_same_package
-      expect(resolver.restoreAbsolute(source), uri);
     }
     return source;
   }
diff --git a/pkg/analyzer_plugin/test/plugin/mocks.dart b/pkg/analyzer_plugin/test/plugin/mocks.dart
index bf4de1d..fd3665f 100644
--- a/pkg/analyzer_plugin/test/plugin/mocks.dart
+++ b/pkg/analyzer_plugin/test/plugin/mocks.dart
@@ -159,31 +159,15 @@
   @override
   TimestampedData<String> get contents => TimestampedData(0, '');
 
-  @Deprecated('Not used anymore')
-  @override
-  String get encoding => '';
-
   @override
   String get fullName => '/pkg/lib/test.dart';
 
-  @Deprecated('Use uri.isScheme("dart") instead')
-  @override
-  bool get isInSystemLibrary => false;
-
-  @Deprecated('Not used anymore')
-  @override
-  int get modificationStamp => 0;
-
   @override
   String get shortName => 'test.dart';
 
   @override
   Uri get uri => Uri.parse('package:test/test.dart');
 
-  @Deprecated('Use Source.uri instead')
-  @override
-  UriKind get uriKind => UriKind.PACKAGE_URI;
-
   @override
   bool exists() => true;
 }
diff --git a/pkg/front_end/test/scanner_fasta_test.dart b/pkg/front_end/test/scanner_fasta_test.dart
index 215423e..27c1276 100644
--- a/pkg/front_end/test/scanner_fasta_test.dart
+++ b/pkg/front_end/test/scanner_fasta_test.dart
@@ -212,66 +212,6 @@
     expect(token.precedingComments?.lexeme, '// EOF comment');
   }
 
-  void test_CommentToken_remove() {
-    const code = '''
-/// aaa
-/// bbbb
-/// ccccc
-main() {}
-''';
-
-    late Token token;
-    late fasta.CommentToken c1;
-    late fasta.CommentToken c2;
-    late fasta.CommentToken c3;
-
-    void prepareTokens() {
-      token = scanString(code, includeComments: true).tokens;
-
-      expect(token.type.kind, fasta.IDENTIFIER_TOKEN);
-
-      c1 = token.precedingComments!;
-      c2 = c1.next as fasta.CommentToken;
-      c3 = c2.next as fasta.CommentToken;
-      expect(c3.next, isNull);
-
-      expect(c1.parent, token);
-      expect(c2.parent, token);
-      expect(c3.parent, token);
-
-      expect(c1.lexeme, '/// aaa');
-      expect(c2.lexeme, '/// bbbb');
-      expect(c3.lexeme, '/// ccccc');
-    }
-
-    // Remove the first token.
-    {
-      prepareTokens();
-      c1.remove();
-      expect(token.precedingComments, c2);
-      expect(c2.next, c3);
-      expect(c3.next, isNull);
-    }
-
-    // Remove the second token.
-    {
-      prepareTokens();
-      c2.remove();
-      expect(token.precedingComments, c1);
-      expect(c1.next, c3);
-      expect(c3.next, isNull);
-    }
-
-    // Remove the last token.
-    {
-      prepareTokens();
-      c3.remove();
-      expect(token.precedingComments, c1);
-      expect(c1.next, c2);
-      expect(c2.next, isNull);
-    }
-  }
-
   void test_double_error() {
     String source = "3457e";
     ErrorListener listener = new ErrorListener();
diff --git a/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc b/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
index 36516fc..a323582 100644
--- a/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
+++ b/runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
@@ -1111,8 +1111,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 // NativeFinalizer tests
 
-DART_EXPORT void SetArgumentTo42(intptr_t* token) {
-  *token = 42;
+DART_EXPORT void SetArgumentTo42(void* token) {
+  *reinterpret_cast<intptr_t*>(token) = 42;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/runtime/lib/ffi.cc b/runtime/lib/ffi.cc
index 20f6756..a27fcf6 100644
--- a/runtime/lib/ffi.cc
+++ b/runtime/lib/ffi.cc
@@ -273,10 +273,10 @@
   }
   // The next call cannot be in safepoint.
   if (external_size_diff > 0) {
-    IsolateGroup::Current()->heap()->AllocatedExternal(external_size_diff,
+    thread->isolate_group()->heap()->AllocatedExternal(external_size_diff,
                                                        space);
   } else {
-    IsolateGroup::Current()->heap()->FreedExternal(-external_size_diff, space);
+    thread->isolate_group()->heap()->FreedExternal(-external_size_diff, space);
   }
 };
 
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 8feee00..bba74ca 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -58,10 +58,12 @@
 [ $builder_tag == optimization_counter_threshold ]
 cc/*: Skip # Many tests want see unoptimized code running
 dart/appjit*: SkipByDesign # Test needs to a particular opt-counter value
+dart/finalizer/finalizer_isolate_groups_run_gc_test: SkipByDesign # GC happens at unpredictable times.
 dart/kernel_determinism_test: SkipSlow
 dart/minimal_kernel_test: SkipSlow # gen_kernel is too slow with optimization_counter_threshold
 dart/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow with optimization_counter_threshold
 dart_2/appjit*: SkipByDesign # Test needs to a particular opt-counter value
+dart_2/finalizer/finalizer_isolate_groups_run_gc_test: SkipByDesign # GC happens at unpredictable times.
 dart_2/kernel_determinism_test: SkipSlow
 dart_2/minimal_kernel_test: SkipSlow # gen_kernel is too slow with optimization_counter_threshold
 dart_2/null_safety_autodetection_in_kernel_compiler_test: SkipSlow # gen_kernel is too slow with optimization_counter_threshold
diff --git a/runtime/vm/heap/gc_shared.cc b/runtime/vm/heap/gc_shared.cc
index a9e7275..2f204d9 100644
--- a/runtime/vm/heap/gc_shared.cc
+++ b/runtime/vm/heap/gc_shared.cc
@@ -37,7 +37,9 @@
 }
 
 Heap::Space SpaceForExternal(FinalizerEntryPtr raw_entry) {
-  ASSERT(!raw_entry->untag()->value().IsSmi());
+  // Not Smi, these cannot be integers. They either need to be valid Expando
+  // keys (Finalizer) or Finalizable (NativeFinalizer).
+  ASSERT(raw_entry->untag()->value().IsHeapObject());
   return raw_entry->untag()->value()->IsOldObject() ? Heap::kOld : Heap::kNew;
 }
 
diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc
index e11759a..d2f7de4 100644
--- a/runtime/vm/heap/scavenger.cc
+++ b/runtime/vm/heap/scavenger.cc
@@ -1212,9 +1212,13 @@
       if (UNLIKELY(class_id == kFinalizerEntryCid)) {
         FinalizerEntryPtr raw_entry =
             static_cast<FinalizerEntryPtr>(raw_object);
+        if (FLAG_trace_finalizers) {
+          THR_Print("Scavenger::IterateStoreBuffers Processing Entry %p\n",
+                    raw_entry->untag());
+        }
         // Detect `FinalizerEntry::value` promotion to update external space.
         //
-        // This treats old-space FinalizerEntry fields as strong. Values, deatch
+        // This treats old-space FinalizerEntry fields as strong. Values, detach
         // keys, and finalizers in new space won't be reclaimed until after they
         // are promoted.
         // This will only visit the strong references, end enqueue the entry.
@@ -1225,13 +1229,15 @@
           const Heap::Space after_gc_space = SpaceForExternal(raw_entry);
           if (after_gc_space == Heap::kOld) {
             const intptr_t external_size = raw_entry->untag()->external_size_;
-            if (FLAG_trace_finalizers) {
-              THR_Print(
-                  "Scavenger %p Store buffer, promoting external size %" Pd
-                  " bytes from new to old space\n",
-                  visitor, external_size);
+            if (external_size > 0) {
+              if (FLAG_trace_finalizers) {
+                THR_Print(
+                    "Scavenger %p Store buffer, promoting external size %" Pd
+                    " bytes from new to old space\n",
+                    visitor, external_size);
+              }
+              visitor->isolate_group()->heap()->PromotedExternal(external_size);
             }
-            visitor->isolate_group()->heap()->PromotedExternal(external_size);
           }
         }
       } else {
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index e797f5c..6541884 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2462,7 +2462,9 @@
 }
 #endif  // !defined(PRODUCT)
 
-void Isolate::LowLevelShutdown() {
+void Isolate::RunAndCleanupFinalizersOnShutdown() {
+  if (finalizers_ == GrowableObjectArray::null()) return;
+
   // Ensure we have a zone and handle scope so that we can call VM functions,
   // but we no longer allocate new heap objects.
   Thread* thread = Thread::Current();
@@ -2470,15 +2472,6 @@
   HandleScope handle_scope(thread);
   NoSafepointScope no_safepoint_scope;
 
-  // Notify exit listeners that this isolate is shutting down.
-  if (group()->object_store() != nullptr) {
-    const Error& error = Error::Handle(thread->sticky_error());
-    if (error.IsNull() || !error.IsUnwindError() ||
-        UnwindError::Cast(error).is_user_initiated()) {
-      NotifyExitListeners();
-    }
-  }
-
   // Set live finalizers isolate to null, before deleting the message handler.
   const auto& finalizers =
       GrowableObjectArray::Handle(stack_zone.GetZone(), finalizers_);
@@ -2517,6 +2510,24 @@
       }
     }
   }
+}
+
+void Isolate::LowLevelShutdown() {
+  // Ensure we have a zone and handle scope so that we can call VM functions,
+  // but we no longer allocate new heap objects.
+  Thread* thread = Thread::Current();
+  StackZone stack_zone(thread);
+  HandleScope handle_scope(thread);
+  NoSafepointScope no_safepoint_scope;
+
+  // Notify exit listeners that this isolate is shutting down.
+  if (group()->object_store() != nullptr) {
+    const Error& error = Error::Handle(thread->sticky_error());
+    if (error.IsNull() || !error.IsUnwindError() ||
+        UnwindError::Cast(error).is_user_initiated()) {
+      NotifyExitListeners();
+    }
+  }
 
   // Close all the ports owned by this isolate.
   PortMap::ClosePorts(message_handler());
@@ -2629,6 +2640,11 @@
   // Then, proceed with low-level teardown.
   Isolate::UnMarkIsolateReady(this);
 
+  // Ensure native finalizers are run before isolate has shutdown message is
+  // sent. This way users can rely on the exit message that an isolate will not
+  // run any Dart code anymore _and_ will not run any native finalizers anymore.
+  RunAndCleanupFinalizersOnShutdown();
+
   // Post message before LowLevelShutdown that sends onExit message.
   // This ensures that exit message comes last.
   if (bequest_.get() != nullptr) {
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 76bbd89..5b7eaad 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -1482,6 +1482,7 @@
   void KillLocked(LibMsgId msg_id);
 
   void Shutdown();
+  void RunAndCleanupFinalizersOnShutdown();
   void LowLevelShutdown();
 
   // Unregister the [isolate] from the thread, remove it from the isolate group,
diff --git a/tools/VERSION b/tools/VERSION
index e10152e..6dd49ee 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 278
+PRERELEASE 279
 PRERELEASE_PATCH 0
\ No newline at end of file