diff --git a/example/lib/src/multiplier_generator.dart b/example/lib/src/multiplier_generator.dart index 7bc762ea..d00b83fa 100644 --- a/example/lib/src/multiplier_generator.dart +++ b/example/lib/src/multiplier_generator.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/example/lib/src/property_product_generator.dart b/example/lib/src/property_product_generator.dart index 5317e0c4..dc4f96a6 100644 --- a/example/lib/src/property_product_generator.dart +++ b/example/lib/src/property_product_generator.dart @@ -12,6 +12,7 @@ class PropertyProductGenerator extends Generator { String generate(LibraryReader library, BuildStep buildStep) { final productNames = topLevelNumVariables( library, + // ignore: deprecated_member_use until analyzer 7 support is dropped. ).map((element) => element.name3).join(' * '); return ''' diff --git a/example/lib/src/property_sum_generator.dart b/example/lib/src/property_sum_generator.dart index cc4b297a..d945a200 100644 --- a/example/lib/src/property_sum_generator.dart +++ b/example/lib/src/property_sum_generator.dart @@ -12,6 +12,7 @@ class PropertySumGenerator extends Generator { String generate(LibraryReader library, BuildStep buildStep) { final sumNames = topLevelNumVariables( library, + // ignore: deprecated_member_use until analyzer 7 support is dropped. ).map((element) => element.name3).join(' + '); return ''' diff --git a/example/lib/src/utils.dart b/example/lib/src/utils.dart index aad73b91..0fd1776c 100644 --- a/example/lib/src/utils.dart +++ b/example/lib/src/utils.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/source_gen/lib/src/builder.dart b/source_gen/lib/src/builder.dart index 25bbfafd..6eaba0ff 100644 --- a/source_gen/lib/src/builder.dart +++ b/source_gen/lib/src/builder.dart @@ -5,6 +5,7 @@ import 'dart:convert'; import 'package:analyzer/dart/ast/ast.dart'; +// ignore: deprecated_member_use until analyzer 7 support is dropped. import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:dart_style/dart_style.dart'; @@ -109,6 +110,7 @@ class _Builder extends Builder { } Future _generateForLibrary( + // ignore: deprecated_member_use until analyzer 7 support is dropped. LibraryElement2 library, BuildStep buildStep, ) async { @@ -355,6 +357,7 @@ class LibraryBuilder extends _Builder { } Stream _generate( + // ignore: deprecated_member_use until analyzer 7 support is dropped. LibraryElement2 library, List generators, BuildStep buildStep, @@ -440,6 +443,7 @@ const partIdRegExpLiteral = r'[A-Za-z_\d-]+'; final _partIdRegExp = RegExp('^$partIdRegExpLiteral\$'); +// ignore: deprecated_member_use until analyzer 7 support is dropped. String languageOverrideForLibrary(LibraryElement2 library) { final override = library.languageVersion.override; return override == null diff --git a/source_gen/lib/src/constants/reader.dart b/source_gen/lib/src/constants/reader.dart index 6e6501c4..3b7c48f9 100644 --- a/source_gen/lib/src/constants/reader.dart +++ b/source_gen/lib/src/constants/reader.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/dart/constant/value.dart'; +// ignore: deprecated_member_use until analyzer 7 support is dropped. import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/dart/element/type.dart'; @@ -268,6 +269,7 @@ class _DartObjectConstant extends ConstantReader { ConstantReader read(String field) { final reader = peek(field); if (reader == null) { + // ignore: deprecated_member_use until analyzer 7 support is dropped. assertHasField(objectValue.type!.element3 as InterfaceElement2, field); return const _NullConstant(); } diff --git a/source_gen/lib/src/constants/utils.dart b/source_gen/lib/src/constants/utils.dart index a557f1fb..85069529 100644 --- a/source_gen/lib/src/constants/utils.dart +++ b/source_gen/lib/src/constants/utils.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element2.dart'; diff --git a/source_gen/lib/src/generator.dart b/source_gen/lib/src/generator.dart index 3d8eba36..60f06299 100644 --- a/source_gen/lib/src/generator.dart +++ b/source_gen/lib/src/generator.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'package:analyzer/dart/ast/ast.dart'; +// ignore: deprecated_member_use until analyzer 7 support is dropped. import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:source_span/source_span.dart'; @@ -46,7 +47,8 @@ class InvalidGenerationSource implements Exception { /// May be an empty string if unknown. final String todo; - /// The [Element2] associated with this error, if any. + /// The `Element2` associated with this error, if any. + /// ignore: deprecated_member_use until analyzer 7 support is dropped. final Element2? element; /// The [ElementDirective] associated with this error, if any. @@ -62,12 +64,14 @@ class InvalidGenerationSource implements Exception { this.message, { Annotatable? annotatable, this.todo = '', + // ignore: deprecated_member_use until analyzer 7 support is dropped. Element2? element, ElementDirective? elementDirective, Fragment? fragment, this.node, }) : element = element ?? + // ignore: deprecated_member_use until analyzer 7 support is dropped. (annotatable is Element2 ? annotatable : null) as Element2?, elementDirective = elementDirective ?? diff --git a/source_gen/lib/src/generator_for_annotation.dart b/source_gen/lib/src/generator_for_annotation.dart index 6e582f57..5e1a3b52 100644 --- a/source_gen/lib/src/generator_for_annotation.dart +++ b/source_gen/lib/src/generator_for_annotation.dart @@ -4,6 +4,7 @@ import 'dart:async'; +// ignore: deprecated_member_use until analyzer 7 support is dropped. import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; @@ -38,7 +39,7 @@ import 'type_checker.dart'; /// Elements which are not at the top level, such as the members of a class or /// extension, are not searched for annotations. To operate on, for instance, /// annotated fields of a class ensure that the class itself is annotated with -/// [T] and use the [Element2] to iterate over fields. The [TypeChecker] utility +/// [T] and use the `Element2` to iterate over fields. The [TypeChecker] utility /// may be helpful to check which elements have a given annotation. abstract class GeneratorForAnnotation extends Generator { final bool throwOnUnresolved; @@ -126,6 +127,7 @@ abstract class GeneratorForAnnotation extends Generator { /// Implementations should return `null` when no content is generated. Empty /// or whitespace-only [String] instances are also ignored. dynamic generateForAnnotatedElement( + // ignore: deprecated_member_use until analyzer 7 support is dropped. Element2 element, ConstantReader annotation, BuildStep buildStep, diff --git a/source_gen/lib/src/library.dart b/source_gen/lib/src/library.dart index f25a0e1d..6da70ccb 100644 --- a/source_gen/lib/src/library.dart +++ b/source_gen/lib/src/library.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:path/path.dart' as p; diff --git a/source_gen/lib/src/span_for_element.dart b/source_gen/lib/src/span_for_element.dart index edbb6420..3c66cea0 100644 --- a/source_gen/lib/src/span_for_element.dart +++ b/source_gen/lib/src/span_for_element.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element2.dart'; import 'package:source_span/source_span.dart'; diff --git a/source_gen/lib/src/type_checker.dart b/source_gen/lib/src/type_checker.dart index 9acb7035..42c2ed6d 100644 --- a/source_gen/lib/src/type_checker.dart +++ b/source_gen/lib/src/type_checker.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'dart:mirrors' hide SourceLocation; import 'package:analyzer/dart/analysis/results.dart'; diff --git a/source_gen/lib/src/utils.dart b/source_gen/lib/src/utils.dart index a94ed91b..619d0ffb 100644 --- a/source_gen/lib/src/utils.dart +++ b/source_gen/lib/src/utils.dart @@ -4,6 +4,8 @@ import 'dart:io'; +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/dart/element/type.dart'; diff --git a/source_gen/pubspec.yaml b/source_gen/pubspec.yaml index aa6da555..7e5a1a0a 100644 --- a/source_gen/pubspec.yaml +++ b/source_gen/pubspec.yaml @@ -27,3 +27,6 @@ dev_dependencies: logging: ^1.2.0 term_glyph: ^1.2.0 test: ^1.25.9 + +dependency_overrides: + analyzer: ^8.0.0 diff --git a/source_gen/test/constants/utils_test.dart b/source_gen/test/constants/utils_test.dart index 563109af..f500d19d 100644 --- a/source_gen/test/constants/utils_test.dart +++ b/source_gen/test/constants/utils_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element2.dart'; import 'package:build_test/build_test.dart'; diff --git a/source_gen/test/constants_test.dart b/source_gen/test/constants_test.dart index cc963167..866edf83 100644 --- a/source_gen/test/constants_test.dart +++ b/source_gen/test/constants_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/constant/value.dart'; import 'package:build_test/build_test.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/source_gen/test/external_only_type_checker_test.dart b/source_gen/test/external_only_type_checker_test.dart index ce5f60a1..2af437f7 100644 --- a/source_gen/test/external_only_type_checker_test.dart +++ b/source_gen/test/external_only_type_checker_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + // The tests in this file are only ran externally, as the behavior only works // externally. Internally this test is skipped. diff --git a/source_gen/test/generator_for_annotation_test.dart b/source_gen/test/generator_for_annotation_test.dart index 343c57be..aa8e5982 100644 --- a/source_gen/test/generator_for_annotation_test.dart +++ b/source_gen/test/generator_for_annotation_test.dart @@ -6,6 +6,8 @@ @Timeout.factor(3) library; +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element2.dart'; @@ -170,6 +172,7 @@ $dartFormatWidth LibraryImport() => '// LibraryImport', LibraryExport() => '// LibraryExport', PartInclude() => '// PartInclude', + ElementDirective() => '// ElementDirective', }, elementBehavior: (element) => '// ${element.runtimeType}', ), diff --git a/source_gen/test/library/find_type_test.dart b/source_gen/test/library/find_type_test.dart index 4095d8a0..178dcd93 100644 --- a/source_gen/test/library/find_type_test.dart +++ b/source_gen/test/library/find_type_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; diff --git a/source_gen/test/library/path_to_url_test.dart b/source_gen/test/library/path_to_url_test.dart index c94e8415..9b4db665 100644 --- a/source_gen/test/library/path_to_url_test.dart +++ b/source_gen/test/library/path_to_url_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + // Increase timeouts on this test which resolves source code and can be slow. import 'package:analyzer/dart/element/element2.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/source_gen/test/span_for_element_test.dart b/source_gen/test/span_for_element_test.dart index f85eb138..5b5690e0 100644 --- a/source_gen/test/span_for_element_test.dart +++ b/source_gen/test/span_for_element_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:build_test/build_test.dart'; diff --git a/source_gen/test/src/comment_generator.dart b/source_gen/test/src/comment_generator.dart index 115a9a29..814ec079 100644 --- a/source_gen/test/src/comment_generator.dart +++ b/source_gen/test/src/comment_generator.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/source_gen/test/type_checker_test.dart b/source_gen/test/type_checker_test.dart index bc30c8ee..9850a3a5 100644 --- a/source_gen/test/type_checker_test.dart +++ b/source_gen/test/type_checker_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // ignore_for_file: unreachable_from_main +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. // Increase timeouts on this test which resolves source code and can be slow. @Timeout.factor(2.0) diff --git a/source_gen/test/utils_test.dart b/source_gen/test/utils_test.dart index d2e4d91b..ec04447c 100644 --- a/source_gen/test/utils_test.dart +++ b/source_gen/test/utils_test.dart @@ -6,6 +6,8 @@ @Timeout.factor(2.0) library; +// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped. + import 'package:analyzer/dart/element/element2.dart'; import 'package:build_test/build_test.dart'; import 'package:source_gen/src/utils.dart';