diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md index dbca635c476..0d5fb279652 100644 --- a/pkg/analyzer/CHANGELOG.md +++ b/pkg/analyzer/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.7.0-dev +* Deprecated `File.createSource()`, it violates levels of abstraction. + You can get `Source` instances from `AnalysisResult`s. + ## 6.6.0 * Stop exporting `src/file_system/file_system.dart` from `file_system/file_system.dart`. diff --git a/pkg/analyzer/lib/file_system/file_system.dart b/pkg/analyzer/lib/file_system/file_system.dart index 411d2e62f1a..c99a701d4e8 100644 --- a/pkg/analyzer/lib/file_system/file_system.dart +++ b/pkg/analyzer/lib/file_system/file_system.dart @@ -31,6 +31,7 @@ abstract class File implements Resource { File copyTo(Folder parentFolder); /// Create a new [Source] instance that serves this file. + @Deprecated('Get Source instances from analysis results') Source createSource([Uri? uri]); /// Synchronously read the entire file contents as a list of bytes. diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart index 1146b5a756d..2d1eb0ca3d5 100644 --- a/pkg/analyzer/lib/file_system/memory_file_system.dart +++ b/pkg/analyzer/lib/file_system/memory_file_system.dart @@ -354,6 +354,7 @@ class _MemoryFile extends _MemoryResource implements File { return destination; } + @Deprecated('Get Source instances from analysis results') @override Source createSource([Uri? uri]) { uri ??= provider.pathContext.toUri(path); diff --git a/pkg/analyzer/lib/file_system/overlay_file_system.dart b/pkg/analyzer/lib/file_system/overlay_file_system.dart index 1be0be7df8b..205acb5d71d 100644 --- a/pkg/analyzer/lib/file_system/overlay_file_system.dart +++ b/pkg/analyzer/lib/file_system/overlay_file_system.dart @@ -167,6 +167,7 @@ class _OverlayFile extends _OverlayResource implements File { } } + @Deprecated('Get Source instances from analysis results') @override Source createSource([Uri? uri]) => FileSource(this, uri ?? provider.pathContext.toUri(path)); diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart index 0086901777b..e82f04e0ad7 100644 --- a/pkg/analyzer/lib/file_system/physical_file_system.dart +++ b/pkg/analyzer/lib/file_system/physical_file_system.dart @@ -136,6 +136,7 @@ class _PhysicalFile extends _PhysicalResource implements File { return destination; } + @Deprecated('Get Source instances from analysis results') @override Source createSource([Uri? uri]) { return FileSource(this, uri ?? pathContext.toUri(path)); diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml index cc53679db09..51d49ff0aad 100644 --- a/pkg/analyzer/pubspec.yaml +++ b/pkg/analyzer/pubspec.yaml @@ -1,5 +1,5 @@ name: analyzer -version: 6.6.0 +version: 6.7.0-dev description: >- This package provides a library that performs static analysis of Dart code. repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer