[analyzer] Make a pubic URI for clients to import TimestampedData. The `TimestampedData` class is already exposed through the analyzer API as a result of its use in the public `Source` class; this change merely allows clients to refer to it directly without importing from `package:analyzer/src`. Making this change will allow an import of `package:analyzer/src` to be removed from dartdoc. Change-Id: I4d28662854513ba0098ef1f5279cb7cb276e832b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442163 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/api.txt b/pkg/analyzer/api.txt index 9f356c6..accb8f7 100644 --- a/pkg/analyzer/api.txt +++ b/pkg/analyzer/api.txt
@@ -5199,6 +5199,11 @@ intersects (method: bool Function(SourceRange?)) startsIn (method: bool Function(SourceRange)) toString (method: String Function()) +package:analyzer/source/timestamped_data.dart: + TimestampedData (class<E> extends Object): + new (constructor: TimestampedData<E> Function(int, E)) + data (getter: E) + modificationTime (getter: int) package:analyzer/src/dart/analysis/experiments_impl.dart: ExperimentalFeature (class extends Object implements Feature): new (constructor: ExperimentalFeature Function({List<String> channels, required String documentation, required String enableString, required Version? experimentalReleaseVersion, required int index, required bool isEnabledByDefault, required bool isExpired, required Version? releaseVersion})) @@ -5227,11 +5232,6 @@ definedNames2 (getter: Map<String, Element>) get2 (method: Element? Function(String)) getPrefixed2 (method: Element? Function(String, String)) -package:analyzer/src/generated/timestamped_data.dart: - TimestampedData (class<E> extends Object): - new (constructor: TimestampedData<E> Function(int, E)) - data (getter: E) - modificationTime (getter: int) package:analyzer/src/lint/config.dart: RuleConfig (non-public) package:analyzer/src/workspace/workspace.dart:
diff --git a/pkg/analyzer/lib/source/timestamped_data.dart b/pkg/analyzer/lib/source/timestamped_data.dart new file mode 100644 index 0000000..eaaec7d --- /dev/null +++ b/pkg/analyzer/lib/source/timestamped_data.dart
@@ -0,0 +1,16 @@ +// Copyright (c) 2025, 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. + +/// Analysis data for which we have a modification time. +class TimestampedData<E> { + /// The modification time of the source from which the data was created. + final int modificationTime; + + /// The data that was created from the source. + final E data; + + /// Initialize a newly created holder to associate the given [data] with the + /// given [modificationTime]. + TimestampedData(this.modificationTime, this.data); +}
diff --git a/pkg/analyzer/lib/src/generated/timestamped_data.dart b/pkg/analyzer/lib/src/generated/timestamped_data.dart index 5499be0..3dec324 100644 --- a/pkg/analyzer/lib/src/generated/timestamped_data.dart +++ b/pkg/analyzer/lib/src/generated/timestamped_data.dart
@@ -2,18 +2,10 @@ // 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/base/analyzer_public_api.dart'; +// This export is needed because package `dartdoc` imports the `TimestampedData` +// class from here. +// +// TODO(paulberry): update dartdoc's import, so that this library can be +// deprecated and eventually removed. -/// Analysis data for which we have a modification time. -@AnalyzerPublicApi(message: 'exposed by Source.contents') -class TimestampedData<E> { - /// The modification time of the source from which the data was created. - final int modificationTime; - - /// The data that was created from the source. - final E data; - - /// Initialize a newly created holder to associate the given [data] with the - /// given [modificationTime]. - TimestampedData(this.modificationTime, this.data); -} +export 'package:analyzer/source/timestamped_data.dart' show TimestampedData;