From 68f25877c7ec8ab67720d32ed544d649dcf2afac Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 07:21:19 +0200 Subject: [PATCH 1/9] add reproduction test --- .../diff/test_package_static_test.dart | 63 +++++++++++++++++++ .../package_a_with_static_element/.gitignore | 7 +++ .../CHANGELOG.md | 3 + .../package_a_with_static_element/README.md | 39 ++++++++++++ .../analysis_options.yaml | 30 +++++++++ .../lib/package_a.dart | 8 +++ .../lib/src/class_a.dart | 13 ++++ .../pubspec.yaml | 14 +++++ .../.gitignore | 7 +++ .../CHANGELOG.md | 3 + .../README.md | 39 ++++++++++++ .../analysis_options.yaml | 30 +++++++++ .../lib/package_a.dart | 6 ++ .../lib/src/class_a.dart | 9 +++ .../pubspec.yaml | 14 +++++ 15 files changed, 285 insertions(+) create mode 100644 test/integration_tests/diff/test_package_static_test.dart create mode 100644 test/test_packages/static_elements/package_a_with_static_element/.gitignore create mode 100644 test/test_packages/static_elements/package_a_with_static_element/CHANGELOG.md create mode 100644 test/test_packages/static_elements/package_a_with_static_element/README.md create mode 100644 test/test_packages/static_elements/package_a_with_static_element/analysis_options.yaml create mode 100644 test/test_packages/static_elements/package_a_with_static_element/lib/package_a.dart create mode 100644 test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart create mode 100644 test/test_packages/static_elements/package_a_with_static_element/pubspec.yaml create mode 100644 test/test_packages/static_elements/package_a_without_static_element/.gitignore create mode 100644 test/test_packages/static_elements/package_a_without_static_element/CHANGELOG.md create mode 100644 test/test_packages/static_elements/package_a_without_static_element/README.md create mode 100644 test/test_packages/static_elements/package_a_without_static_element/analysis_options.yaml create mode 100644 test/test_packages/static_elements/package_a_without_static_element/lib/package_a.dart create mode 100644 test/test_packages/static_elements/package_a_without_static_element/lib/src/class_a.dart create mode 100644 test/test_packages/static_elements/package_a_without_static_element/pubspec.yaml diff --git a/test/integration_tests/diff/test_package_static_test.dart b/test/integration_tests/diff/test_package_static_test.dart new file mode 100644 index 0000000..20796f3 --- /dev/null +++ b/test/integration_tests/diff/test_package_static_test.dart @@ -0,0 +1,63 @@ +import 'package:dart_apitool/api_tool.dart'; +import 'package:test/test.dart'; +import 'package:path/path.dart' as path; + +void main() { + group('test_package_static_test', () { + late PackageApiAnalyzer packageAWithoutStaticElement; + late PackageApiAnalyzer packageAWithStaticElement; + + setUpAll( + () { + packageAWithoutStaticElement = PackageApiAnalyzer( + packagePath: path.join( + 'test', + 'test_packages', + 'static_elements', + 'package_a_without_static_element', + )); + packageAWithStaticElement = PackageApiAnalyzer( + packagePath: path.join( + 'test', + 'test_packages', + 'static_elements', + 'package_a_with_static_element', + )); + }, + ); + group('adding a static method to a required type', () { + late PackageApiDiffResult diffResult; + setUpAll(() async { + diffResult = PackageApiDiffer().diff( + oldApi: await packageAWithoutStaticElement.analyze(), + newApi: await packageAWithStaticElement.analyze(), + ); + }); + + test('detects the addition of the static type', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewStaticMethod'), + ), + ), + ); + }); + + test('addition of the static type is not breaking', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewStaticMethod') && + !change.isBreaking, + ), + ), + ); + }); + }); + }); +} diff --git a/test/test_packages/static_elements/package_a_with_static_element/.gitignore b/test/test_packages/static_elements/package_a_with_static_element/.gitignore new file mode 100644 index 0000000..3cceda5 --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/test/test_packages/static_elements/package_a_with_static_element/CHANGELOG.md b/test/test_packages/static_elements/package_a_with_static_element/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/test/test_packages/static_elements/package_a_with_static_element/README.md b/test/test_packages/static_elements/package_a_with_static_element/README.md new file mode 100644 index 0000000..8b55e73 --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/test/test_packages/static_elements/package_a_with_static_element/analysis_options.yaml b/test/test_packages/static_elements/package_a_with_static_element/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/test/test_packages/static_elements/package_a_with_static_element/lib/package_a.dart b/test/test_packages/static_elements/package_a_with_static_element/lib/package_a.dart new file mode 100644 index 0000000..235a2a7 --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/lib/package_a.dart @@ -0,0 +1,8 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library package_a_with_wider_types; + +export 'src/class_a.dart'; + +// TODO: Export any libraries intended for clients of this package. diff --git a/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart b/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart new file mode 100644 index 0000000..8e8dece --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart @@ -0,0 +1,13 @@ +abstract class ClassA { + String instanceMethod() { + return 'instanceMethod${thisIsANewStaticMethod()}'; + } + + static String thisIsANewStaticMethod() { + return 'staticMethod'; + } +} + +String useClassASoThatItBecomesRequired(ClassA classA) { + return classA.instanceMethod(); +} diff --git a/test/test_packages/static_elements/package_a_with_static_element/pubspec.yaml b/test/test_packages/static_elements/package_a_with_static_element/pubspec.yaml new file mode 100644 index 0000000..0592066 --- /dev/null +++ b/test/test_packages/static_elements/package_a_with_static_element/pubspec.yaml @@ -0,0 +1,14 @@ +name: package_a +description: A starting point for Dart libraries or applications. +version: 1.1.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: '>=2.18.4 <3.0.0' + +# dependencies: +# path: ^1.8.0 + +dev_dependencies: + lints: ^2.0.0 + test: ^1.21.0 diff --git a/test/test_packages/static_elements/package_a_without_static_element/.gitignore b/test/test_packages/static_elements/package_a_without_static_element/.gitignore new file mode 100644 index 0000000..3cceda5 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/test/test_packages/static_elements/package_a_without_static_element/CHANGELOG.md b/test/test_packages/static_elements/package_a_without_static_element/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/test/test_packages/static_elements/package_a_without_static_element/README.md b/test/test_packages/static_elements/package_a_without_static_element/README.md new file mode 100644 index 0000000..8b55e73 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/test/test_packages/static_elements/package_a_without_static_element/analysis_options.yaml b/test/test_packages/static_elements/package_a_without_static_element/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/test/test_packages/static_elements/package_a_without_static_element/lib/package_a.dart b/test/test_packages/static_elements/package_a_without_static_element/lib/package_a.dart new file mode 100644 index 0000000..a2274d2 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/lib/package_a.dart @@ -0,0 +1,6 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library package_a_with_narrow_types; + +export 'src/class_a.dart'; diff --git a/test/test_packages/static_elements/package_a_without_static_element/lib/src/class_a.dart b/test/test_packages/static_elements/package_a_without_static_element/lib/src/class_a.dart new file mode 100644 index 0000000..4d2d2a7 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/lib/src/class_a.dart @@ -0,0 +1,9 @@ +abstract class ClassA { + String instanceMethod() { + return 'instanceMethod'; + } +} + +String useClassASoThatItBecomesRequired(ClassA classA) { + return classA.instanceMethod(); +} diff --git a/test/test_packages/static_elements/package_a_without_static_element/pubspec.yaml b/test/test_packages/static_elements/package_a_without_static_element/pubspec.yaml new file mode 100644 index 0000000..4b4f212 --- /dev/null +++ b/test/test_packages/static_elements/package_a_without_static_element/pubspec.yaml @@ -0,0 +1,14 @@ +name: package_a +description: A starting point for Dart libraries or applications. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: '>=2.18.4 <3.0.0' + +# dependencies: +# path: ^1.8.0 + +dev_dependencies: + lints: ^2.0.0 + test: ^1.21.0 From 5771789c3ebc5d06dccdd74395b780a9e611c2a2 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 07:21:30 +0200 Subject: [PATCH 2/9] bump Flutter version --- .fvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.fvmrc b/.fvmrc index db15b84..26d017c 100644 --- a/.fvmrc +++ b/.fvmrc @@ -1,4 +1,4 @@ { - "flutter": "3.19.5", + "flutter": "3.22.2", "flavors": {} } \ No newline at end of file From 71e8f0a293667284444d4210e7b40fbf97bf8bf5 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 07:35:13 +0200 Subject: [PATCH 3/9] treat addition of new static methods as non breaking extend reproduction tests & fix to static fields and consts --- lib/src/diff/package_api_differ.dart | 66 +++++++++++-------- lib/src/model/field_declaration.dart | 3 + lib/src/model/field_declaration.freezed.dart | 29 +++++++- .../internal/internal_field_declaration.dart | 4 ++ .../v3/platform_constraints_storage_v3.g.dart | 6 +- .../diff/test_package_static_test.dart | 54 ++++++++++++++- test/package_api_differ_test_data.dart | 2 + test/package_api_storage_test.dart | 1 + .../lib/src/class_a.dart | 3 + 9 files changed, 133 insertions(+), 35 deletions(-) diff --git a/lib/src/diff/package_api_differ.dart b/lib/src/diff/package_api_differ.dart index 966f13f..c27b443 100644 --- a/lib/src/diff/package_api_differ.dart +++ b/lib/src/diff/package_api_differ.dart @@ -274,38 +274,44 @@ class PackageApiDiffer { final changes = []; for (final oldEx in executableListDiff.matches.keys) { final newEx = executableListDiff.matches[oldEx]!; - changes.addAll(_calculateExecutableDiff( - oldEx, - newEx, - context, - isInterfaceRequired: isInterfaceRequired, - isExperimental: newEx.isExperimental || isExperimental, - typeHierarchy: typeHierarchy, - )); + changes.addAll( + _calculateExecutableDiff( + oldEx, + newEx, + context, + isInterfaceRequired: isInterfaceRequired, + isExperimental: newEx.isExperimental || isExperimental, + typeHierarchy: typeHierarchy, + ), + ); } for (final removedExecutable in executableListDiff.remainingOld) { - changes.add(ApiChange( - changeCode: ApiChangeCode.ce10, - affectedDeclaration: removedExecutable, - contextTrace: _contextTraceFromStack(context), - type: ApiChangeType.remove, - isExperimental: isExperimental, - changeDescription: - '${_getExecutableTypeName(removedExecutable.type, context.isNotEmpty)} "${removedExecutable.name}" removed', - )); + changes.add( + ApiChange( + changeCode: ApiChangeCode.ce10, + affectedDeclaration: removedExecutable, + contextTrace: _contextTraceFromStack(context), + type: ApiChangeType.remove, + isExperimental: isExperimental, + changeDescription: + '${_getExecutableTypeName(removedExecutable.type, context.isNotEmpty)} "${removedExecutable.name}" removed', + ), + ); } for (final addedExecutable in executableListDiff.remainingNew) { - changes.add(ApiChange( - changeCode: ApiChangeCode.ce11, - affectedDeclaration: addedExecutable, - contextTrace: _contextTraceFromStack(context), - type: isInterfaceRequired ?? false - ? ApiChangeType.addBreaking - : ApiChangeType.addCompatibleMinor, - isExperimental: isExperimental, - changeDescription: - '${_getExecutableTypeName(addedExecutable.type, context.isNotEmpty)} "${addedExecutable.name}" added${(isInterfaceRequired ?? false) ? ' (required)' : ''}', - )); + changes.add( + ApiChange( + changeCode: ApiChangeCode.ce11, + affectedDeclaration: addedExecutable, + contextTrace: _contextTraceFromStack(context), + type: (isInterfaceRequired ?? false) && !addedExecutable.isStatic + ? ApiChangeType.addBreaking + : ApiChangeType.addCompatibleMinor, + isExperimental: isExperimental, + changeDescription: + '${_getExecutableTypeName(addedExecutable.type, context.isNotEmpty)} "${addedExecutable.name}" added${(isInterfaceRequired ?? false) ? ' (required)' : ''}', + ), + ); } return changes; } @@ -823,7 +829,9 @@ class PackageApiDiffer { changeCode: ApiChangeCode.cf02, affectedDeclaration: addedField, contextTrace: _contextTraceFromStack(context), - type: (isInterfaceRequired ?? false) + type: (isInterfaceRequired ?? false) && + !addedField.isStatic && + !addedField.isConst ? ApiChangeType.addBreaking : ApiChangeType.addCompatibleMinor, isExperimental: isExperimental, diff --git a/lib/src/model/field_declaration.dart b/lib/src/model/field_declaration.dart index 2037d81..4e62cb5 100644 --- a/lib/src/model/field_declaration.dart +++ b/lib/src/model/field_declaration.dart @@ -31,6 +31,9 @@ class FieldDeclaration with _$FieldDeclaration implements Declaration { /// whether this field is static required bool isStatic, + /// whether this field is a constant + required bool isConst, + /// whether this field is experimental required bool isExperimental, diff --git a/lib/src/model/field_declaration.freezed.dart b/lib/src/model/field_declaration.freezed.dart index 002a1d9..f3897bb 100644 --- a/lib/src/model/field_declaration.freezed.dart +++ b/lib/src/model/field_declaration.freezed.dart @@ -31,6 +31,9 @@ mixin _$FieldDeclaration { /// whether this field is static bool get isStatic => throw _privateConstructorUsedError; + /// whether this field is a constant + bool get isConst => throw _privateConstructorUsedError; + /// whether this field is experimental bool get isExperimental => throw _privateConstructorUsedError; @@ -63,6 +66,7 @@ abstract class $FieldDeclarationCopyWith<$Res> { String name, bool isDeprecated, bool isStatic, + bool isConst, bool isExperimental, Set? entryPoints, String relativePath, @@ -88,6 +92,7 @@ class _$FieldDeclarationCopyWithImpl<$Res, $Val extends FieldDeclaration> Object? name = null, Object? isDeprecated = null, Object? isStatic = null, + Object? isConst = null, Object? isExperimental = null, Object? entryPoints = freezed, Object? relativePath = null, @@ -115,6 +120,10 @@ class _$FieldDeclarationCopyWithImpl<$Res, $Val extends FieldDeclaration> ? _value.isStatic : isStatic // ignore: cast_nullable_to_non_nullable as bool, + isConst: null == isConst + ? _value.isConst + : isConst // ignore: cast_nullable_to_non_nullable + as bool, isExperimental: null == isExperimental ? _value.isExperimental : isExperimental // ignore: cast_nullable_to_non_nullable @@ -153,6 +162,7 @@ abstract class _$$FieldDeclarationImplCopyWith<$Res> String name, bool isDeprecated, bool isStatic, + bool isConst, bool isExperimental, Set? entryPoints, String relativePath, @@ -176,6 +186,7 @@ class __$$FieldDeclarationImplCopyWithImpl<$Res> Object? name = null, Object? isDeprecated = null, Object? isStatic = null, + Object? isConst = null, Object? isExperimental = null, Object? entryPoints = freezed, Object? relativePath = null, @@ -203,6 +214,10 @@ class __$$FieldDeclarationImplCopyWithImpl<$Res> ? _value.isStatic : isStatic // ignore: cast_nullable_to_non_nullable as bool, + isConst: null == isConst + ? _value.isConst + : isConst // ignore: cast_nullable_to_non_nullable + as bool, isExperimental: null == isExperimental ? _value.isExperimental : isExperimental // ignore: cast_nullable_to_non_nullable @@ -236,6 +251,7 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { required this.name, required this.isDeprecated, required this.isStatic, + required this.isConst, required this.isExperimental, final Set? entryPoints, required this.relativePath, @@ -264,6 +280,10 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { @override final bool isStatic; + /// whether this field is a constant + @override + final bool isConst; + /// whether this field is experimental @override final bool isExperimental; @@ -295,7 +315,7 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { @override String toString() { - return 'FieldDeclaration(typeName: $typeName, typeFullLibraryName: $typeFullLibraryName, name: $name, isDeprecated: $isDeprecated, isStatic: $isStatic, isExperimental: $isExperimental, entryPoints: $entryPoints, relativePath: $relativePath, isReadable: $isReadable, isWriteable: $isWriteable)'; + return 'FieldDeclaration(typeName: $typeName, typeFullLibraryName: $typeFullLibraryName, name: $name, isDeprecated: $isDeprecated, isStatic: $isStatic, isConst: $isConst, isExperimental: $isExperimental, entryPoints: $entryPoints, relativePath: $relativePath, isReadable: $isReadable, isWriteable: $isWriteable)'; } @override @@ -312,6 +332,7 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { other.isDeprecated == isDeprecated) && (identical(other.isStatic, isStatic) || other.isStatic == isStatic) && + (identical(other.isConst, isConst) || other.isConst == isConst) && (identical(other.isExperimental, isExperimental) || other.isExperimental == isExperimental) && const DeepCollectionEquality() @@ -332,6 +353,7 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { name, isDeprecated, isStatic, + isConst, isExperimental, const DeepCollectionEquality().hash(_entryPoints), relativePath, @@ -354,6 +376,7 @@ abstract class _FieldDeclaration extends FieldDeclaration required final String name, required final bool isDeprecated, required final bool isStatic, + required final bool isConst, required final bool isExperimental, final Set? entryPoints, required final String relativePath, @@ -383,6 +406,10 @@ abstract class _FieldDeclaration extends FieldDeclaration bool get isStatic; @override + /// whether this field is a constant + bool get isConst; + @override + /// whether this field is experimental bool get isExperimental; @override diff --git a/lib/src/model/internal/internal_field_declaration.dart b/lib/src/model/internal/internal_field_declaration.dart index c3ca3a2..98401cf 100644 --- a/lib/src/model/internal/internal_field_declaration.dart +++ b/lib/src/model/internal/internal_field_declaration.dart @@ -18,6 +18,7 @@ class InternalFieldDeclaration implements InternalDeclaration { final bool isDeprecated; final bool isExperimental; final bool isStatic; + final bool isConst; @override final Set? entryPoints; @override @@ -35,6 +36,7 @@ class InternalFieldDeclaration implements InternalDeclaration { required this.isDeprecated, required this.isExperimental, required this.isStatic, + required this.isConst, required this.entryPoints, required this.relativePath, required this.isReadable, @@ -58,6 +60,7 @@ class InternalFieldDeclaration implements InternalDeclaration { isExperimental: InternalDeclarationUtils.hasExperimental(fieldElement), isStatic: fieldElement.isStatic, + isConst: fieldElement.isConst, entryPoints: {}, relativePath: InternalDeclarationUtils.getRelativePath(rootPath, fieldElement), @@ -74,6 +77,7 @@ class InternalFieldDeclaration implements InternalDeclaration { isDeprecated: isDeprecated, isExperimental: isExperimental, isStatic: isStatic, + isConst: isConst, entryPoints: entryPoints, relativePath: relativePath, isReadable: isReadable, diff --git a/lib/src/storage/v3/platform_constraints_storage_v3.g.dart b/lib/src/storage/v3/platform_constraints_storage_v3.g.dart index a99513f..d257525 100644 --- a/lib/src/storage/v3/platform_constraints_storage_v3.g.dart +++ b/lib/src/storage/v3/platform_constraints_storage_v3.g.dart @@ -24,9 +24,9 @@ _$AndroidPlatformConstraintsStorageV3Impl _$$AndroidPlatformConstraintsStorageV3ImplFromJson( Map json) => _$AndroidPlatformConstraintsStorageV3Impl( - minSdkVersion: (json['minSdkVersion'] as num?)?.toInt(), - compileSdkVersion: (json['compileSdkVersion'] as num?)?.toInt(), - targetSdkVersion: (json['targetSdkVersion'] as num?)?.toInt(), + minSdkVersion: json['minSdkVersion'] as int?, + compileSdkVersion: json['compileSdkVersion'] as int?, + targetSdkVersion: json['targetSdkVersion'] as int?, ); Map _$$AndroidPlatformConstraintsStorageV3ImplToJson( diff --git a/test/integration_tests/diff/test_package_static_test.dart b/test/integration_tests/diff/test_package_static_test.dart index 20796f3..253ba7d 100644 --- a/test/integration_tests/diff/test_package_static_test.dart +++ b/test/integration_tests/diff/test_package_static_test.dart @@ -34,7 +34,7 @@ void main() { ); }); - test('detects the addition of the static type', () { + test('detects the addition of a static method', () { expect( diffResult.apiChanges, containsOnce( @@ -46,7 +46,7 @@ void main() { ); }); - test('addition of the static type is not breaking', () { + test('addition of a static method is not breaking', () { expect( diffResult.apiChanges, containsOnce( @@ -58,6 +58,56 @@ void main() { ), ); }); + + test('detects the addition of a static field', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewStaticField'), + ), + ), + ); + }); + + test('addition of a static field is not breaking', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewStaticField') && + !change.isBreaking, + ), + ), + ); + }); + + test('detects the addition of a const', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewConst'), + ), + ), + ); + }); + + test('addition of a const is not breaking', () { + expect( + diffResult.apiChanges, + containsOnce( + predicate( + (ApiChange change) => + change.changeDescription.contains('thisIsANewConst') && + !change.isBreaking, + ), + ), + ); + }); }); }); } diff --git a/test/package_api_differ_test_data.dart b/test/package_api_differ_test_data.dart index 2d77fa7..95c3eb2 100644 --- a/test/package_api_differ_test_data.dart +++ b/test/package_api_differ_test_data.dart @@ -429,6 +429,7 @@ final simpleFieldDeclarationA = FieldDeclaration( isDeprecated: false, isExperimental: false, isStatic: false, + isConst: false, relativePath: '', isReadable: true, isWriteable: true, @@ -440,6 +441,7 @@ final simpleFieldDeclarationB = FieldDeclaration( isDeprecated: false, isExperimental: false, isStatic: false, + isConst: false, relativePath: '', isReadable: true, isWriteable: true, diff --git a/test/package_api_storage_test.dart b/test/package_api_storage_test.dart index 3076bcb..4eabd5a 100644 --- a/test/package_api_storage_test.dart +++ b/test/package_api_storage_test.dart @@ -142,6 +142,7 @@ final testPackageApi = PackageApi( isDeprecated: false, isExperimental: false, isStatic: false, + isConst: false, entryPoints: {}, relativePath: '', isReadable: true, diff --git a/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart b/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart index 8e8dece..46c8fb9 100644 --- a/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart +++ b/test/test_packages/static_elements/package_a_with_static_element/lib/src/class_a.dart @@ -6,6 +6,9 @@ abstract class ClassA { static String thisIsANewStaticMethod() { return 'staticMethod'; } + + static int thisIsANewStaticField = 5; + const int thisIsANewConst = 42; } String useClassASoThatItBecomesRequired(ClassA classA) { From b9f27833f8565e1318a9e8f064bd98fe23afcd0c Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 07:36:32 +0200 Subject: [PATCH 4/9] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2618160..8ae9dfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Version 0.19.0 - introduces `force-use-flutter` option for all commands to force dart_apitool to use the `flutter` command. - extend type usage tracking and fix situations in which types that are used in @visibleForTesting contexts were detected as not exported +- fix: don't treat adding static elements (methods, fields) or consts to a required interface as breaking ## Version 0.18.0 - add missing export to json output for `extract` command From 64d9627c0f49d1cbe3ac202db584428075cab3f1 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 07:43:11 +0200 Subject: [PATCH 5/9] running newest version of builders --- .../analyze/package_api_analyzer.freezed.dart | 17 ++++- .../model/executable_declaration.freezed.dart | 76 ++++++++++++------- lib/src/model/field_declaration.freezed.dart | 40 ++++++---- .../model/interface_declaration.freezed.dart | 42 ++++++---- lib/src/model/package_api.freezed.dart | 50 +++++++----- lib/src/model/package_dependency.freezed.dart | 22 ++++-- .../model/platform_constraints.freezed.dart | 44 ++++++++--- .../model/type_alias_declaration.freezed.dart | 30 +++++--- lib/src/model/type_hierarchy.freezed.dart | 48 ++++++++---- lib/src/model/type_usage.freezed.dart | 24 ++++-- ...utable_declaration_storage_v3.freezed.dart | 42 ++++++++-- .../field_declaration_storage_v3.freezed.dart | 21 ++++- ...erface_declaration_storage_v3.freezed.dart | 21 ++++- .../v3/package_api_storage_v3.freezed.dart | 25 +++++- ...package_dependency_storage_v3.freezed.dart | 21 ++++- ...atform_constraints_storage_v3.freezed.dart | 42 ++++++++-- .../v3/platform_constraints_storage_v3.g.dart | 6 +- ..._alias_declaration_storage_v3.freezed.dart | 21 ++++- 18 files changed, 425 insertions(+), 167 deletions(-) diff --git a/lib/src/analyze/package_api_analyzer.freezed.dart b/lib/src/analyze/package_api_analyzer.freezed.dart index 1b5912c..e23b4e2 100644 --- a/lib/src/analyze/package_api_analyzer.freezed.dart +++ b/lib/src/analyze/package_api_analyzer.freezed.dart @@ -21,7 +21,9 @@ mixin _$FileToAnalyzeEntry { List get hiddenNames => throw _privateConstructorUsedError; Set get exportedBy => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of _FileToAnalyzeEntry + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$FileToAnalyzeEntryCopyWith<_FileToAnalyzeEntry> get copyWith => throw _privateConstructorUsedError; } @@ -49,6 +51,8 @@ class __$FileToAnalyzeEntryCopyWithImpl<$Res, $Val extends _FileToAnalyzeEntry> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of _FileToAnalyzeEntry + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -101,6 +105,8 @@ class __$$_FileToAnalyzeEntryImplCopyWithImpl<$Res> $Res Function(_$_FileToAnalyzeEntryImpl) _then) : super(_value, _then); + /// Create a copy of _FileToAnalyzeEntry + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -198,7 +204,9 @@ class _$_FileToAnalyzeEntryImpl implements __FileToAnalyzeEntry { const DeepCollectionEquality().hash(_hiddenNames), const DeepCollectionEquality().hash(_exportedBy)); - @JsonKey(ignore: true) + /// Create a copy of _FileToAnalyzeEntry + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$_FileToAnalyzeEntryImplCopyWith<_$_FileToAnalyzeEntryImpl> get copyWith => @@ -221,8 +229,11 @@ abstract class __FileToAnalyzeEntry implements _FileToAnalyzeEntry { List get hiddenNames; @override Set get exportedBy; + + /// Create a copy of _FileToAnalyzeEntry + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$_FileToAnalyzeEntryImplCopyWith<_$_FileToAnalyzeEntryImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/executable_declaration.freezed.dart b/lib/src/model/executable_declaration.freezed.dart index 84182a0..4229538 100644 --- a/lib/src/model/executable_declaration.freezed.dart +++ b/lib/src/model/executable_declaration.freezed.dart @@ -40,7 +40,9 @@ mixin _$ExecutableParameterDeclaration { /// the relative path of the library String get relativePath => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of ExecutableParameterDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ExecutableParameterDeclarationCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -75,6 +77,8 @@ class _$ExecutableParameterDeclarationCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ExecutableParameterDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -154,6 +158,8 @@ class __$$ExecutableParameterDeclarationImplCopyWithImpl<$Res> $Res Function(_$ExecutableParameterDeclarationImpl) _then) : super(_value, _then); + /// Create a copy of ExecutableParameterDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -288,7 +294,9 @@ class _$ExecutableParameterDeclarationImpl typeFullLibraryName, relativePath); - @JsonKey(ignore: true) + /// Create a copy of ExecutableParameterDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ExecutableParameterDeclarationImplCopyWith< @@ -311,40 +319,42 @@ abstract class _ExecutableParameterDeclaration _$ExecutableParameterDeclarationImpl; const _ExecutableParameterDeclaration._() : super._(); - @override - /// whether the parameter is required - bool get isRequired; @override + bool get isRequired; /// whether the parameter is named - bool get isNamed; @override + bool get isNamed; /// the name of the parameter - String get name; @override + String get name; /// whether the parameter is deprecated - bool get isDeprecated; @override + bool get isDeprecated; /// whether the parameter is experimental - bool get isExperimental; @override + bool get isExperimental; /// type name of this parameter - String get typeName; @override + String get typeName; /// the type library path - String? get typeFullLibraryName; @override + String? get typeFullLibraryName; /// the relative path of the library + @override String get relativePath; + + /// Create a copy of ExecutableParameterDeclaration + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$ExecutableParameterDeclarationImplCopyWith< _$ExecutableParameterDeclarationImpl> get copyWith => throw _privateConstructorUsedError; @@ -385,7 +395,9 @@ mixin _$ExecutableDeclaration { /// the relative path of the library String get relativePath => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of ExecutableDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ExecutableDeclarationCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -421,6 +433,8 @@ class _$ExecutableDeclarationCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ExecutableDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -517,6 +531,8 @@ class __$$ExecutableDeclarationImplCopyWithImpl<$Res> $Res Function(_$ExecutableDeclarationImpl) _then) : super(_value, _then); + /// Create a copy of ExecutableDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -716,7 +732,9 @@ class _$ExecutableDeclarationImpl extends _ExecutableDeclaration { const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of ExecutableDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ExecutableDeclarationImplCopyWith<_$ExecutableDeclarationImpl> @@ -739,50 +757,52 @@ abstract class _ExecutableDeclaration extends ExecutableDeclaration { required final String relativePath}) = _$ExecutableDeclarationImpl; const _ExecutableDeclaration._() : super._(); - @override - /// name of the return type - String get returnTypeName; - @override // full library name of the return type - String? get returnTypeFullLibraryName; @override + String get returnTypeName; // full library name of the return type + @override + String? get returnTypeFullLibraryName; /// name of the executable - String get name; @override + String get name; /// whether the executable is deprecated - bool get isDeprecated; @override + bool get isDeprecated; /// whether the executable is experimental - bool get isExperimental; @override + bool get isExperimental; /// list of the executables parameters ([ExecutableOParameterDeclaration]s) - List get parameters; @override + List get parameters; /// type parameter names of this executable - List get typeParameterNames; @override + List get typeParameterNames; /// type of the executable - ExecutableType get type; @override + ExecutableType get type; /// whether the executable is a static method - bool get isStatic; @override + bool get isStatic; /// entry points for this executable - Set? get entryPoints; @override + Set? get entryPoints; /// the relative path of the library + @override String get relativePath; + + /// Create a copy of ExecutableDeclaration + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$ExecutableDeclarationImplCopyWith<_$ExecutableDeclarationImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/field_declaration.freezed.dart b/lib/src/model/field_declaration.freezed.dart index f3897bb..82d81c5 100644 --- a/lib/src/model/field_declaration.freezed.dart +++ b/lib/src/model/field_declaration.freezed.dart @@ -49,7 +49,9 @@ mixin _$FieldDeclaration { /// whether this field is writeable bool get isWriteable => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of FieldDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $FieldDeclarationCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -84,6 +86,8 @@ class _$FieldDeclarationCopyWithImpl<$Res, $Val extends FieldDeclaration> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of FieldDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -178,6 +182,8 @@ class __$$FieldDeclarationImplCopyWithImpl<$Res> $Res Function(_$FieldDeclarationImpl) _then) : super(_value, _then); + /// Create a copy of FieldDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -360,7 +366,9 @@ class _$FieldDeclarationImpl extends _FieldDeclaration { isReadable, isWriteable); - @JsonKey(ignore: true) + /// Create a copy of FieldDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$FieldDeclarationImplCopyWith<_$FieldDeclarationImpl> get copyWith => @@ -384,52 +392,54 @@ abstract class _FieldDeclaration extends FieldDeclaration required final bool isWriteable}) = _$FieldDeclarationImpl; const _FieldDeclaration._() : super._(); - @override - /// type of this field - String get typeName; @override + String get typeName; /// full library name for the type - String? get typeFullLibraryName; @override + String? get typeFullLibraryName; /// name of this field - String get name; @override + String get name; /// whether this field is deprecated - bool get isDeprecated; @override + bool get isDeprecated; /// whether this field is static - bool get isStatic; @override + bool get isStatic; /// whether this field is a constant - bool get isConst; @override + bool get isConst; /// whether this field is experimental - bool get isExperimental; @override + bool get isExperimental; /// entry points this field is reachable through - Set? get entryPoints; @override + Set? get entryPoints; /// the relative path of the library - String get relativePath; @override + String get relativePath; /// whether this field is readable - bool get isReadable; @override + bool get isReadable; /// whether this field is writeable + @override bool get isWriteable; + + /// Create a copy of FieldDeclaration + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$FieldDeclarationImplCopyWith<_$FieldDeclarationImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/interface_declaration.freezed.dart b/lib/src/model/interface_declaration.freezed.dart index ab73dea..1fd954c 100644 --- a/lib/src/model/interface_declaration.freezed.dart +++ b/lib/src/model/interface_declaration.freezed.dart @@ -54,7 +54,9 @@ mixin _$InterfaceDeclaration { /// the relative path of the library String get relativePath => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of InterfaceDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $InterfaceDeclarationCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -91,6 +93,8 @@ class _$InterfaceDeclarationCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of InterfaceDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -191,6 +195,8 @@ class __$$InterfaceDeclarationImplCopyWithImpl<$Res> $Res Function(_$InterfaceDeclarationImpl) _then) : super(_value, _then); + /// Create a copy of InterfaceDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -430,7 +436,9 @@ class _$InterfaceDeclarationImpl extends _InterfaceDeclaration { const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of InterfaceDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$InterfaceDeclarationImplCopyWith<_$InterfaceDeclarationImpl> @@ -456,56 +464,58 @@ abstract class _InterfaceDeclaration extends InterfaceDeclaration required final String relativePath}) = _$InterfaceDeclarationImpl; const _InterfaceDeclaration._() : super._(); - @override - /// name of this interface - String get name; @override + String get name; /// whether this interface is deprecated - bool get isDeprecated; @override + bool get isDeprecated; /// whether this interface is experimental - bool get isExperimental; @override + bool get isExperimental; /// determines if this declaration is sealed - bool get isSealed; @override + bool get isSealed; /// determines if this declaration is abstract - bool get isAbstract; @override + bool get isAbstract; /// usages of this interface - Set get typeUsages; @override + Set get typeUsages; /// list of type parameter names - List get typeParameterNames; @override + List get typeParameterNames; /// set of super type names - Set get superTypeNames; @override + Set get superTypeNames; /// executables that belong to this interface - List get executableDeclarations; @override + List get executableDeclarations; /// fields that belong to this interface - List get fieldDeclarations; @override + List get fieldDeclarations; /// entry points this interface is reachable through - Set? get entryPoints; @override + Set? get entryPoints; /// the relative path of the library + @override String get relativePath; + + /// Create a copy of InterfaceDeclaration + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$InterfaceDeclarationImplCopyWith<_$InterfaceDeclarationImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/package_api.freezed.dart b/lib/src/model/package_api.freezed.dart index 7fda40e..61a15c6 100644 --- a/lib/src/model/package_api.freezed.dart +++ b/lib/src/model/package_api.freezed.dart @@ -65,7 +65,9 @@ mixin _$PackageApi { /// the type hierarchy of the public API TypeHierarchy get typeHierarchy => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PackageApiCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -106,6 +108,8 @@ class _$PackageApiCopyWithImpl<$Res, $Val extends PackageApi> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -184,6 +188,8 @@ class _$PackageApiCopyWithImpl<$Res, $Val extends PackageApi> ) as $Val); } + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AndroidPlatformConstraintsCopyWith<$Res>? get androidPlatformConstraints { @@ -197,6 +203,8 @@ class _$PackageApiCopyWithImpl<$Res, $Val extends PackageApi> }); } + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $IOSPlatformConstraintsCopyWith<$Res>? get iosPlatformConstraints { @@ -249,6 +257,8 @@ class __$$PackageApiImplCopyWithImpl<$Res> _$PackageApiImpl _value, $Res Function(_$PackageApiImpl) _then) : super(_value, _then); + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -517,7 +527,9 @@ class _$PackageApiImpl extends _PackageApi { minSdkVersion, typeHierarchy); - @JsonKey(ignore: true) + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PackageApiImplCopyWith<_$PackageApiImpl> get copyWith => @@ -542,64 +554,66 @@ abstract class _PackageApi extends PackageApi { required final TypeHierarchy typeHierarchy}) = _$PackageApiImpl; const _PackageApi._() : super._(); - @override - /// name of the package - String get packageName; @override + String get packageName; /// version of the package - String? get packageVersion; @override + String? get packageVersion; /// path to the package - String get packagePath; @override + String get packagePath; /// interface declarations this package has - List get interfaceDeclarations; @override + List get interfaceDeclarations; /// root level executable declarations this package has - List get executableDeclarations; @override + List get executableDeclarations; /// root level field declarations this package has - List get fieldDeclarations; @override + List get fieldDeclarations; /// type alias declarations this package has - List get typeAliasDeclarations; @override + List get typeAliasDeclarations; /// the semantics of this model. This indicates if this model is compatible (e.g. for diffing) with another model - Set get semantics; @override + Set get semantics; /// used Android platform constraints - AndroidPlatformConstraints? get androidPlatformConstraints; @override + AndroidPlatformConstraints? get androidPlatformConstraints; /// used iOS platform constraints - IOSPlatformConstraints? get iosPlatformConstraints; @override + IOSPlatformConstraints? get iosPlatformConstraints; /// type of sdk needed - SdkType get sdkType; @override + SdkType get sdkType; /// package dependencies - List get packageDependencies; @override + List get packageDependencies; /// minimum sdk version - Version get minSdkVersion; @override + Version get minSdkVersion; /// the type hierarchy of the public API + @override TypeHierarchy get typeHierarchy; + + /// Create a copy of PackageApi + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PackageApiImplCopyWith<_$PackageApiImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/package_dependency.freezed.dart b/lib/src/model/package_dependency.freezed.dart index 7ea7816..8d57135 100644 --- a/lib/src/model/package_dependency.freezed.dart +++ b/lib/src/model/package_dependency.freezed.dart @@ -22,7 +22,9 @@ mixin _$PackageDependency { /// String representation of the version range. Can be null if the dependency is a path or git dependency String? get packageVersion => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of PackageDependency + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PackageDependencyCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -46,6 +48,8 @@ class _$PackageDependencyCopyWithImpl<$Res, $Val extends PackageDependency> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PackageDependency + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -84,6 +88,8 @@ class __$$PackageDependencyImplCopyWithImpl<$Res> $Res Function(_$PackageDependencyImpl) _then) : super(_value, _then); + /// Create a copy of PackageDependency + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -136,7 +142,9 @@ class _$PackageDependencyImpl implements _PackageDependency { @override int get hashCode => Object.hash(runtimeType, packageName, packageVersion); - @JsonKey(ignore: true) + /// Create a copy of PackageDependency + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PackageDependencyImplCopyWith<_$PackageDependencyImpl> get copyWith => @@ -149,16 +157,18 @@ abstract class _PackageDependency implements PackageDependency { {required final String packageName, required final String? packageVersion}) = _$PackageDependencyImpl; - @override - /// name of the package - String get packageName; @override + String get packageName; /// String representation of the version range. Can be null if the dependency is a path or git dependency + @override String? get packageVersion; + + /// Create a copy of PackageDependency + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PackageDependencyImplCopyWith<_$PackageDependencyImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/platform_constraints.freezed.dart b/lib/src/model/platform_constraints.freezed.dart index f104de4..ee5cd36 100644 --- a/lib/src/model/platform_constraints.freezed.dart +++ b/lib/src/model/platform_constraints.freezed.dart @@ -19,7 +19,9 @@ mixin _$IOSPlatformConstraints { /// minimum iOS version num? get minimumOsVersion => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of IOSPlatformConstraints + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $IOSPlatformConstraintsCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -44,6 +46,8 @@ class _$IOSPlatformConstraintsCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of IOSPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -80,6 +84,8 @@ class __$$IOSPlatformConstraintsImplCopyWithImpl<$Res> $Res Function(_$IOSPlatformConstraintsImpl) _then) : super(_value, _then); + /// Create a copy of IOSPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -120,7 +126,9 @@ class _$IOSPlatformConstraintsImpl implements _IOSPlatformConstraints { @override int get hashCode => Object.hash(runtimeType, minimumOsVersion); - @JsonKey(ignore: true) + /// Create a copy of IOSPlatformConstraints + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$IOSPlatformConstraintsImplCopyWith<_$IOSPlatformConstraintsImpl> @@ -132,12 +140,14 @@ abstract class _IOSPlatformConstraints implements IOSPlatformConstraints { const factory _IOSPlatformConstraints( {required final num? minimumOsVersion}) = _$IOSPlatformConstraintsImpl; - @override - /// minimum iOS version + @override num? get minimumOsVersion; + + /// Create a copy of IOSPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$IOSPlatformConstraintsImplCopyWith<_$IOSPlatformConstraintsImpl> get copyWith => throw _privateConstructorUsedError; } @@ -153,7 +163,9 @@ mixin _$AndroidPlatformConstraints { /// target SDK version int? get targetSdkVersion => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of AndroidPlatformConstraints + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $AndroidPlatformConstraintsCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -180,6 +192,8 @@ class _$AndroidPlatformConstraintsCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of AndroidPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -227,6 +241,8 @@ class __$$AndroidPlatformConstraintsImplCopyWithImpl<$Res> $Res Function(_$AndroidPlatformConstraintsImpl) _then) : super(_value, _then); + /// Create a copy of AndroidPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -293,7 +309,9 @@ class _$AndroidPlatformConstraintsImpl implements _AndroidPlatformConstraints { int get hashCode => Object.hash( runtimeType, minSdkVersion, compileSdkVersion, targetSdkVersion); - @JsonKey(ignore: true) + /// Create a copy of AndroidPlatformConstraints + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$AndroidPlatformConstraintsImplCopyWith<_$AndroidPlatformConstraintsImpl> @@ -308,20 +326,22 @@ abstract class _AndroidPlatformConstraints required final int? compileSdkVersion, required final int? targetSdkVersion}) = _$AndroidPlatformConstraintsImpl; - @override - /// minimum SDK version - int? get minSdkVersion; @override + int? get minSdkVersion; /// compile SDK version - int? get compileSdkVersion; @override + int? get compileSdkVersion; /// target SDK version + @override int? get targetSdkVersion; + + /// Create a copy of AndroidPlatformConstraints + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$AndroidPlatformConstraintsImplCopyWith<_$AndroidPlatformConstraintsImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/type_alias_declaration.freezed.dart b/lib/src/model/type_alias_declaration.freezed.dart index 4efde4e..0c294a2 100644 --- a/lib/src/model/type_alias_declaration.freezed.dart +++ b/lib/src/model/type_alias_declaration.freezed.dart @@ -34,7 +34,9 @@ mixin _$TypeAliasDeclaration { /// the relative path of the library String get relativePath => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of TypeAliasDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $TypeAliasDeclarationCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -65,6 +67,8 @@ class _$TypeAliasDeclarationCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of TypeAliasDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -129,6 +133,8 @@ class __$$TypeAliasDeclarationImplCopyWithImpl<$Res> $Res Function(_$TypeAliasDeclarationImpl) _then) : super(_value, _then); + /// Create a copy of TypeAliasDeclaration + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -247,7 +253,9 @@ class _$TypeAliasDeclarationImpl extends _TypeAliasDeclaration { const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of TypeAliasDeclaration + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$TypeAliasDeclarationImplCopyWith<_$TypeAliasDeclarationImpl> @@ -267,32 +275,34 @@ abstract class _TypeAliasDeclaration extends TypeAliasDeclaration required final String relativePath}) = _$TypeAliasDeclarationImpl; const _TypeAliasDeclaration._() : super._(); - @override - /// name of this type alias - String get name; @override + String get name; /// name of the aliased type - String get aliasedTypeName; @override + String get aliasedTypeName; /// whether this type alias is deprecated - bool get isDeprecated; @override + bool get isDeprecated; /// whether this type alias is experimental - bool get isExperimental; @override + bool get isExperimental; /// entry points this type alias is reachable through - Set? get entryPoints; @override + Set? get entryPoints; /// the relative path of the library + @override String get relativePath; + + /// Create a copy of TypeAliasDeclaration + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$TypeAliasDeclarationImplCopyWith<_$TypeAliasDeclarationImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/type_hierarchy.freezed.dart b/lib/src/model/type_hierarchy.freezed.dart index e387eaa..5a83903 100644 --- a/lib/src/model/type_hierarchy.freezed.dart +++ b/lib/src/model/type_hierarchy.freezed.dart @@ -25,7 +25,9 @@ mixin _$TypeIdentifier { /// the library path inside the package defining that type String get packageRelativeLibraryPath => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of TypeIdentifier + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $TypeIdentifierCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -50,6 +52,8 @@ class _$TypeIdentifierCopyWithImpl<$Res, $Val extends TypeIdentifier> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of TypeIdentifier + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -94,6 +98,8 @@ class __$$TypeIdentifierImplCopyWithImpl<$Res> _$TypeIdentifierImpl _value, $Res Function(_$TypeIdentifierImpl) _then) : super(_value, _then); + /// Create a copy of TypeIdentifier + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -158,7 +164,9 @@ class _$TypeIdentifierImpl extends _TypeIdentifier { int get hashCode => Object.hash( runtimeType, typeName, packageName, packageRelativeLibraryPath); - @JsonKey(ignore: true) + /// Create a copy of TypeIdentifier + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$TypeIdentifierImplCopyWith<_$TypeIdentifierImpl> get copyWith => @@ -173,20 +181,22 @@ abstract class _TypeIdentifier extends TypeIdentifier { required final String packageRelativeLibraryPath}) = _$TypeIdentifierImpl; const _TypeIdentifier._() : super._(); - @override - /// the name of this type - String get typeName; @override + String get typeName; /// the name of the package defining that type - String get packageName; @override + String get packageName; /// the library path inside the package defining that type + @override String get packageRelativeLibraryPath; + + /// Create a copy of TypeIdentifier + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$TypeIdentifierImplCopyWith<_$TypeIdentifierImpl> get copyWith => throw _privateConstructorUsedError; } @@ -200,7 +210,9 @@ mixin _$TypeHierarchyItem { Set get baseTypeIdentifiers => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) _$TypeHierarchyItemCopyWith<_TypeHierarchyItem> get copyWith => throw _privateConstructorUsedError; } @@ -227,6 +239,8 @@ class __$TypeHierarchyItemCopyWithImpl<$Res, $Val extends _TypeHierarchyItem> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -245,6 +259,8 @@ class __$TypeHierarchyItemCopyWithImpl<$Res, $Val extends _TypeHierarchyItem> ) as $Val); } + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $TypeIdentifierCopyWith<$Res> get typeIdentifier { @@ -277,6 +293,8 @@ class __$$_TypeHierarchyItemImplCopyWithImpl<$Res> $Res Function(_$_TypeHierarchyItemImpl) _then) : super(_value, _then); + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -336,7 +354,9 @@ class _$_TypeHierarchyItemImpl extends __TypeHierarchyItem { int get hashCode => Object.hash(runtimeType, typeIdentifier, const DeepCollectionEquality().hash(_baseTypeIdentifiers)); - @JsonKey(ignore: true) + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$_TypeHierarchyItemImplCopyWith<_$_TypeHierarchyItemImpl> get copyWith => @@ -351,16 +371,18 @@ abstract class __TypeHierarchyItem extends _TypeHierarchyItem { _$_TypeHierarchyItemImpl; const __TypeHierarchyItem._() : super._(); - @override - /// the identifier of this type - TypeIdentifier get typeIdentifier; @override + TypeIdentifier get typeIdentifier; /// the type identifiers of the super types of this type + @override Set get baseTypeIdentifiers; + + /// Create a copy of _TypeHierarchyItem + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$_TypeHierarchyItemImplCopyWith<_$_TypeHierarchyItemImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/model/type_usage.freezed.dart b/lib/src/model/type_usage.freezed.dart index 0c1599a..01740da 100644 --- a/lib/src/model/type_usage.freezed.dart +++ b/lib/src/model/type_usage.freezed.dart @@ -25,7 +25,9 @@ mixin _$TypeUsage { /// defines if the usage happened in a visibleForTesting context bool get isVisibleForTesting => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of TypeUsage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $TypeUsageCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -51,6 +53,8 @@ class _$TypeUsageCopyWithImpl<$Res, $Val extends TypeUsage> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of TypeUsage + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -97,6 +101,8 @@ class __$$TypeUsageImplCopyWithImpl<$Res> _$TypeUsageImpl _value, $Res Function(_$TypeUsageImpl) _then) : super(_value, _then); + /// Create a copy of TypeUsage + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -163,7 +169,9 @@ class _$TypeUsageImpl extends _TypeUsage { int get hashCode => Object.hash(runtimeType, kind, referringElementName, isVisibleForTesting); - @JsonKey(ignore: true) + /// Create a copy of TypeUsage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$TypeUsageImplCopyWith<_$TypeUsageImpl> get copyWith => @@ -177,20 +185,22 @@ abstract class _TypeUsage extends TypeUsage { required final bool isVisibleForTesting}) = _$TypeUsageImpl; const _TypeUsage._() : super._(); - @override - /// kind of usage - TypeUsageKind get kind; @override + TypeUsageKind get kind; /// the name of the referring element - String get referringElementName; @override + String get referringElementName; /// defines if the usage happened in a visibleForTesting context + @override bool get isVisibleForTesting; + + /// Create a copy of TypeUsage + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$TypeUsageImplCopyWith<_$TypeUsageImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/storage/v3/executable_declaration_storage_v3.freezed.dart b/lib/src/storage/v3/executable_declaration_storage_v3.freezed.dart index 6f1c297..0d4dbd3 100644 --- a/lib/src/storage/v3/executable_declaration_storage_v3.freezed.dart +++ b/lib/src/storage/v3/executable_declaration_storage_v3.freezed.dart @@ -30,8 +30,12 @@ mixin _$ExecutableParameterDeclarationStorageV3 { String get typeName => throw _privateConstructorUsedError; String get relativePath => throw _privateConstructorUsedError; + /// Serializes this ExecutableParameterDeclarationStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of ExecutableParameterDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ExecutableParameterDeclarationStorageV3CopyWith< ExecutableParameterDeclarationStorageV3> get copyWith => throw _privateConstructorUsedError; @@ -67,6 +71,8 @@ class _$ExecutableParameterDeclarationStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ExecutableParameterDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -140,6 +146,8 @@ class __$$ExecutableParameterDeclarationStorageV3ImplCopyWithImpl<$Res> $Res Function(_$ExecutableParameterDeclarationStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of ExecutableParameterDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -241,12 +249,14 @@ class _$ExecutableParameterDeclarationStorageV3Impl other.relativePath == relativePath)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, isRequired, isNamed, name, isDeprecated, isExperimental, typeName, relativePath); - @JsonKey(ignore: true) + /// Create a copy of ExecutableParameterDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ExecutableParameterDeclarationStorageV3ImplCopyWith< @@ -294,8 +304,11 @@ abstract class _ExecutableParameterDeclarationStorageV3 String get typeName; @override String get relativePath; + + /// Create a copy of ExecutableParameterDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$ExecutableParameterDeclarationStorageV3ImplCopyWith< _$ExecutableParameterDeclarationStorageV3Impl> get copyWith => throw _privateConstructorUsedError; @@ -320,8 +333,12 @@ mixin _$ExecutableDeclarationStorageV3 { Set get entryPoints => throw _privateConstructorUsedError; String get relativePath => throw _privateConstructorUsedError; + /// Serializes this ExecutableDeclarationStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of ExecutableDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ExecutableDeclarationStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -358,6 +375,8 @@ class _$ExecutableDeclarationStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ExecutableDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -449,6 +468,8 @@ class __$$ExecutableDeclarationStorageV3ImplCopyWithImpl<$Res> $Res Function(_$ExecutableDeclarationStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of ExecutableDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -602,7 +623,7 @@ class _$ExecutableDeclarationStorageV3Impl other.relativePath == relativePath)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -617,7 +638,9 @@ class _$ExecutableDeclarationStorageV3Impl const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of ExecutableDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ExecutableDeclarationStorageV3ImplCopyWith< @@ -672,8 +695,11 @@ abstract class _ExecutableDeclarationStorageV3 Set get entryPoints; @override String get relativePath; + + /// Create a copy of ExecutableDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$ExecutableDeclarationStorageV3ImplCopyWith< _$ExecutableDeclarationStorageV3Impl> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/src/storage/v3/field_declaration_storage_v3.freezed.dart b/lib/src/storage/v3/field_declaration_storage_v3.freezed.dart index 8e20639..c4cc8ea 100644 --- a/lib/src/storage/v3/field_declaration_storage_v3.freezed.dart +++ b/lib/src/storage/v3/field_declaration_storage_v3.freezed.dart @@ -31,8 +31,12 @@ mixin _$FieldDeclarationStorageV3 { bool get isReadable => throw _privateConstructorUsedError; bool get isWriteable => throw _privateConstructorUsedError; + /// Serializes this FieldDeclarationStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of FieldDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $FieldDeclarationStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -66,6 +70,8 @@ class _$FieldDeclarationStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of FieldDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -151,6 +157,8 @@ class __$$FieldDeclarationStorageV3ImplCopyWithImpl<$Res> $Res Function(_$FieldDeclarationStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of FieldDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -278,7 +286,7 @@ class _$FieldDeclarationStorageV3Impl extends _FieldDeclarationStorageV3 { other.isWriteable == isWriteable)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -292,7 +300,9 @@ class _$FieldDeclarationStorageV3Impl extends _FieldDeclarationStorageV3 { isReadable, isWriteable); - @JsonKey(ignore: true) + /// Create a copy of FieldDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$FieldDeclarationStorageV3ImplCopyWith<_$FieldDeclarationStorageV3Impl> @@ -341,8 +351,11 @@ abstract class _FieldDeclarationStorageV3 extends FieldDeclarationStorageV3 { bool get isReadable; @override bool get isWriteable; + + /// Create a copy of FieldDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$FieldDeclarationStorageV3ImplCopyWith<_$FieldDeclarationStorageV3Impl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/storage/v3/interface_declaration_storage_v3.freezed.dart b/lib/src/storage/v3/interface_declaration_storage_v3.freezed.dart index 3af330a..3efade6 100644 --- a/lib/src/storage/v3/interface_declaration_storage_v3.freezed.dart +++ b/lib/src/storage/v3/interface_declaration_storage_v3.freezed.dart @@ -35,8 +35,12 @@ mixin _$InterfaceDeclarationStorageV3 { Set get entryPoints => throw _privateConstructorUsedError; String get relativePath => throw _privateConstructorUsedError; + /// Serializes this InterfaceDeclarationStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of InterfaceDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $InterfaceDeclarationStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -74,6 +78,8 @@ class _$InterfaceDeclarationStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of InterfaceDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -171,6 +177,8 @@ class __$$InterfaceDeclarationStorageV3ImplCopyWithImpl<$Res> $Res Function(_$InterfaceDeclarationStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of InterfaceDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -352,7 +360,7 @@ class _$InterfaceDeclarationStorageV3Impl other.relativePath == relativePath)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -368,7 +376,9 @@ class _$InterfaceDeclarationStorageV3Impl const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of InterfaceDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$InterfaceDeclarationStorageV3ImplCopyWith< @@ -427,8 +437,11 @@ abstract class _InterfaceDeclarationStorageV3 Set get entryPoints; @override String get relativePath; + + /// Create a copy of InterfaceDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$InterfaceDeclarationStorageV3ImplCopyWith< _$InterfaceDeclarationStorageV3Impl> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/src/storage/v3/package_api_storage_v3.freezed.dart b/lib/src/storage/v3/package_api_storage_v3.freezed.dart index 091d949..b82013c 100644 --- a/lib/src/storage/v3/package_api_storage_v3.freezed.dart +++ b/lib/src/storage/v3/package_api_storage_v3.freezed.dart @@ -42,8 +42,12 @@ mixin _$PackageApiStorageV3 { List get packageDependencies => throw _privateConstructorUsedError; + /// Serializes this PackageApiStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PackageApiStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -84,6 +88,8 @@ class _$PackageApiStorageV3CopyWithImpl<$Res, $Val extends PackageApiStorageV3> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -157,6 +163,8 @@ class _$PackageApiStorageV3CopyWithImpl<$Res, $Val extends PackageApiStorageV3> ) as $Val); } + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $IOSPlatformConstraintsStorageV3CopyWith<$Res>? get iosPlatformConstraints { @@ -170,6 +178,8 @@ class _$PackageApiStorageV3CopyWithImpl<$Res, $Val extends PackageApiStorageV3> }); } + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AndroidPlatformConstraintsStorageV3CopyWith<$Res>? @@ -223,6 +233,8 @@ class __$$PackageApiStorageV3ImplCopyWithImpl<$Res> $Res Function(_$PackageApiStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -433,7 +445,7 @@ class _$PackageApiStorageV3Impl extends _PackageApiStorageV3 { .equals(other._packageDependencies, _packageDependencies)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -451,7 +463,9 @@ class _$PackageApiStorageV3Impl extends _PackageApiStorageV3 { minSdkVersion, const DeepCollectionEquality().hash(_packageDependencies)); - @JsonKey(ignore: true) + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PackageApiStorageV3ImplCopyWith<_$PackageApiStorageV3Impl> get copyWith => @@ -515,8 +529,11 @@ abstract class _PackageApiStorageV3 extends PackageApiStorageV3 { Version get minSdkVersion; @override List get packageDependencies; + + /// Create a copy of PackageApiStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PackageApiStorageV3ImplCopyWith<_$PackageApiStorageV3Impl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/storage/v3/package_dependency_storage_v3.freezed.dart b/lib/src/storage/v3/package_dependency_storage_v3.freezed.dart index 74da127..6cf8a4b 100644 --- a/lib/src/storage/v3/package_dependency_storage_v3.freezed.dart +++ b/lib/src/storage/v3/package_dependency_storage_v3.freezed.dart @@ -24,8 +24,12 @@ mixin _$PackageDependencyStorageV3 { String get packageName => throw _privateConstructorUsedError; String? get packageVersion => throw _privateConstructorUsedError; + /// Serializes this PackageDependencyStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of PackageDependencyStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PackageDependencyStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -51,6 +55,8 @@ class _$PackageDependencyStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PackageDependencyStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -92,6 +98,8 @@ class __$$PackageDependencyStorageV3ImplCopyWithImpl<$Res> $Res Function(_$PackageDependencyStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of PackageDependencyStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -143,11 +151,13 @@ class _$PackageDependencyStorageV3Impl extends _PackageDependencyStorageV3 { other.packageVersion == packageVersion)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, packageName, packageVersion); - @JsonKey(ignore: true) + /// Create a copy of PackageDependencyStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PackageDependencyStorageV3ImplCopyWith<_$PackageDependencyStorageV3Impl> @@ -176,8 +186,11 @@ abstract class _PackageDependencyStorageV3 extends PackageDependencyStorageV3 { String get packageName; @override String? get packageVersion; + + /// Create a copy of PackageDependencyStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PackageDependencyStorageV3ImplCopyWith<_$PackageDependencyStorageV3Impl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/storage/v3/platform_constraints_storage_v3.freezed.dart b/lib/src/storage/v3/platform_constraints_storage_v3.freezed.dart index 1b3f67e..00223a9 100644 --- a/lib/src/storage/v3/platform_constraints_storage_v3.freezed.dart +++ b/lib/src/storage/v3/platform_constraints_storage_v3.freezed.dart @@ -23,8 +23,12 @@ IOSPlatformConstraintsStorageV3 _$IOSPlatformConstraintsStorageV3FromJson( mixin _$IOSPlatformConstraintsStorageV3 { num? get minimumOsVersion => throw _privateConstructorUsedError; + /// Serializes this IOSPlatformConstraintsStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of IOSPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $IOSPlatformConstraintsStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -51,6 +55,8 @@ class _$IOSPlatformConstraintsStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of IOSPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -87,6 +93,8 @@ class __$$IOSPlatformConstraintsStorageV3ImplCopyWithImpl<$Res> $Res Function(_$IOSPlatformConstraintsStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of IOSPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -129,11 +137,13 @@ class _$IOSPlatformConstraintsStorageV3Impl other.minimumOsVersion == minimumOsVersion)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, minimumOsVersion); - @JsonKey(ignore: true) + /// Create a copy of IOSPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$IOSPlatformConstraintsStorageV3ImplCopyWith< @@ -161,8 +171,11 @@ abstract class _IOSPlatformConstraintsStorageV3 @override num? get minimumOsVersion; + + /// Create a copy of IOSPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$IOSPlatformConstraintsStorageV3ImplCopyWith< _$IOSPlatformConstraintsStorageV3Impl> get copyWith => throw _privateConstructorUsedError; @@ -179,8 +192,12 @@ mixin _$AndroidPlatformConstraintsStorageV3 { int? get compileSdkVersion => throw _privateConstructorUsedError; int? get targetSdkVersion => throw _privateConstructorUsedError; + /// Serializes this AndroidPlatformConstraintsStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of AndroidPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $AndroidPlatformConstraintsStorageV3CopyWith< AndroidPlatformConstraintsStorageV3> get copyWith => throw _privateConstructorUsedError; @@ -209,6 +226,8 @@ class _$AndroidPlatformConstraintsStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of AndroidPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -256,6 +275,8 @@ class __$$AndroidPlatformConstraintsStorageV3ImplCopyWithImpl<$Res> $Res Function(_$AndroidPlatformConstraintsStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of AndroidPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -319,12 +340,14 @@ class _$AndroidPlatformConstraintsStorageV3Impl other.targetSdkVersion == targetSdkVersion)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, minSdkVersion, compileSdkVersion, targetSdkVersion); - @JsonKey(ignore: true) + /// Create a copy of AndroidPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$AndroidPlatformConstraintsStorageV3ImplCopyWith< @@ -359,8 +382,11 @@ abstract class _AndroidPlatformConstraintsStorageV3 int? get compileSdkVersion; @override int? get targetSdkVersion; + + /// Create a copy of AndroidPlatformConstraintsStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$AndroidPlatformConstraintsStorageV3ImplCopyWith< _$AndroidPlatformConstraintsStorageV3Impl> get copyWith => throw _privateConstructorUsedError; diff --git a/lib/src/storage/v3/platform_constraints_storage_v3.g.dart b/lib/src/storage/v3/platform_constraints_storage_v3.g.dart index d257525..a99513f 100644 --- a/lib/src/storage/v3/platform_constraints_storage_v3.g.dart +++ b/lib/src/storage/v3/platform_constraints_storage_v3.g.dart @@ -24,9 +24,9 @@ _$AndroidPlatformConstraintsStorageV3Impl _$$AndroidPlatformConstraintsStorageV3ImplFromJson( Map json) => _$AndroidPlatformConstraintsStorageV3Impl( - minSdkVersion: json['minSdkVersion'] as int?, - compileSdkVersion: json['compileSdkVersion'] as int?, - targetSdkVersion: json['targetSdkVersion'] as int?, + minSdkVersion: (json['minSdkVersion'] as num?)?.toInt(), + compileSdkVersion: (json['compileSdkVersion'] as num?)?.toInt(), + targetSdkVersion: (json['targetSdkVersion'] as num?)?.toInt(), ); Map _$$AndroidPlatformConstraintsStorageV3ImplToJson( diff --git a/lib/src/storage/v3/type_alias_declaration_storage_v3.freezed.dart b/lib/src/storage/v3/type_alias_declaration_storage_v3.freezed.dart index f2b4d11..9f9f4df 100644 --- a/lib/src/storage/v3/type_alias_declaration_storage_v3.freezed.dart +++ b/lib/src/storage/v3/type_alias_declaration_storage_v3.freezed.dart @@ -28,8 +28,12 @@ mixin _$TypeAliasDeclarationStorageV3 { Set get entryPoints => throw _privateConstructorUsedError; String get relativePath => throw _privateConstructorUsedError; + /// Serializes this TypeAliasDeclarationStorageV3 to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of TypeAliasDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $TypeAliasDeclarationStorageV3CopyWith get copyWith => throw _privateConstructorUsedError; } @@ -62,6 +66,8 @@ class _$TypeAliasDeclarationStorageV3CopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of TypeAliasDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -129,6 +135,8 @@ class __$$TypeAliasDeclarationStorageV3ImplCopyWithImpl<$Res> $Res Function(_$TypeAliasDeclarationStorageV3Impl) _then) : super(_value, _then); + /// Create a copy of TypeAliasDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -228,7 +236,7 @@ class _$TypeAliasDeclarationStorageV3Impl other.relativePath == relativePath)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -239,7 +247,9 @@ class _$TypeAliasDeclarationStorageV3Impl const DeepCollectionEquality().hash(_entryPoints), relativePath); - @JsonKey(ignore: true) + /// Create a copy of TypeAliasDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$TypeAliasDeclarationStorageV3ImplCopyWith< @@ -282,8 +292,11 @@ abstract class _TypeAliasDeclarationStorageV3 Set get entryPoints; @override String get relativePath; + + /// Create a copy of TypeAliasDeclarationStorageV3 + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$TypeAliasDeclarationStorageV3ImplCopyWith< _$TypeAliasDeclarationStorageV3Impl> get copyWith => throw _privateConstructorUsedError; From 97ed7bf30554b8ccd45c042bb3f25f273c689729 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 08:31:36 +0200 Subject: [PATCH 6/9] fix analyzer complaint --- .../model/internal/internal_declaration_utils.dart | 14 +++++++++++++- .../internal/internal_executable_declaration.dart | 10 +++++++--- .../model/internal/internal_field_declaration.dart | 4 +++- .../internal/internal_type_alias_declaration.dart | 5 +++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/src/model/internal/internal_declaration_utils.dart b/lib/src/model/internal/internal_declaration_utils.dart index c9ff5d8..6b0b96d 100644 --- a/lib/src/model/internal/internal_declaration_utils.dart +++ b/lib/src/model/internal/internal_declaration_utils.dart @@ -1,3 +1,4 @@ +import 'package:_fe_analyzer_shared/src/type_inference/nullability_suffix.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:path/path.dart' as path; @@ -22,9 +23,20 @@ abstract class InternalDeclarationUtils { return typeParameters.map((e) => e.name).toList(); } + static String getNullabilitySuffixString( + NullabilitySuffix nullabilitySuffix) { + return switch (nullabilitySuffix) { + NullabilitySuffix.none => '', + NullabilitySuffix.question => '?', + NullabilitySuffix.star => '*', + }; + } + static Set computeSuperTypeNames(List allSupertypes) { return allSupertypes - .map((st) => st.getDisplayString(withNullability: true)) + .map((st) => + st.getDisplayString() + + getNullabilitySuffixString(st.nullabilitySuffix)) // if there are supertypes with the same name then only one survives // this is accepted for now as we don't want to dig that far into type hierarchy changes .toSet(); diff --git a/lib/src/model/internal/internal_executable_declaration.dart b/lib/src/model/internal/internal_executable_declaration.dart index 1aed2a0..7a92093 100644 --- a/lib/src/model/internal/internal_executable_declaration.dart +++ b/lib/src/model/internal/internal_executable_declaration.dart @@ -51,8 +51,10 @@ class InternalExecutableDeclaration implements InternalDeclaration { id: InternalDeclarationUtils.getIdFromElement(executableElement)!, parentClassId: InternalDeclarationUtils.getIdFromParentElement( executableElement.enclosingElement), - returnTypeName: executableElement.returnType - .getDisplayString(withNullability: true), + returnTypeName: executableElement.returnType.getDisplayString() + + InternalDeclarationUtils.getNullabilitySuffixString( + executableElement.returnType.nullabilitySuffix, + ), returnTypeFullLibraryName: executableElement.returnType.element?.librarySource?.fullName, name: executableElement.displayName, @@ -112,7 +114,9 @@ class InternalExecutableDeclaration implements InternalDeclaration { name: e.name, isDeprecated: e.hasDeprecated, isExperimental: InternalDeclarationUtils.hasExperimental(e), - typeName: e.type.getDisplayString(withNullability: true), + typeName: e.type.getDisplayString() + + InternalDeclarationUtils.getNullabilitySuffixString( + e.type.nullabilitySuffix), typeFullLibraryName: e.type.element?.librarySource?.fullName, relativePath: relativePath, )) diff --git a/lib/src/model/internal/internal_field_declaration.dart b/lib/src/model/internal/internal_field_declaration.dart index 98401cf..dc35ce3 100644 --- a/lib/src/model/internal/internal_field_declaration.dart +++ b/lib/src/model/internal/internal_field_declaration.dart @@ -51,7 +51,9 @@ class InternalFieldDeclaration implements InternalDeclaration { id: InternalDeclarationUtils.getIdFromElement(fieldElement)!, parentClassId: InternalDeclarationUtils.getIdFromParentElement( fieldElement.enclosingElement), - typeName: fieldElement.type.getDisplayString(withNullability: true), + typeName: fieldElement.type.getDisplayString() + + InternalDeclarationUtils.getNullabilitySuffixString( + fieldElement.type.nullabilitySuffix), typeFullLibraryName: fieldElement.type.element?.librarySource?.fullName, name: fieldElement.name, diff --git a/lib/src/model/internal/internal_type_alias_declaration.dart b/lib/src/model/internal/internal_type_alias_declaration.dart index 1acba9e..3643879 100644 --- a/lib/src/model/internal/internal_type_alias_declaration.dart +++ b/lib/src/model/internal/internal_type_alias_declaration.dart @@ -43,8 +43,9 @@ class InternalTypeAliasDeclaration implements InternalDeclaration { typeAliasElement.enclosingElement), name: typeAliasElement.name, namespace: namespace, - aliasedTypeName: typeAliasElement.aliasedType - .getDisplayString(withNullability: true), + aliasedTypeName: typeAliasElement.aliasedType.getDisplayString() + + InternalDeclarationUtils.getNullabilitySuffixString( + typeAliasElement.aliasedType.nullabilitySuffix), isDeprecated: typeAliasElement.hasDeprecated, isExperimental: InternalDeclarationUtils.hasExperimental(typeAliasElement), From fdafab211eb75d3282b0dc29b210c409f666dd36 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 08:37:58 +0200 Subject: [PATCH 7/9] fiximport & another deprecation issue --- lib/src/model/internal/internal_declaration_utils.dart | 2 +- lib/src/model/internal/internal_interface_declaration.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/model/internal/internal_declaration_utils.dart b/lib/src/model/internal/internal_declaration_utils.dart index 6b0b96d..88b194c 100644 --- a/lib/src/model/internal/internal_declaration_utils.dart +++ b/lib/src/model/internal/internal_declaration_utils.dart @@ -1,5 +1,5 @@ -import 'package:_fe_analyzer_shared/src/type_inference/nullability_suffix.dart'; import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:path/path.dart' as path; diff --git a/lib/src/model/internal/internal_interface_declaration.dart b/lib/src/model/internal/internal_interface_declaration.dart index 1e98258..27cdb37 100644 --- a/lib/src/model/internal/internal_interface_declaration.dart +++ b/lib/src/model/internal/internal_interface_declaration.dart @@ -81,7 +81,7 @@ class InternalInterfaceDeclaration implements InternalDeclaration { rootPath, interfaceElement), superClassIds: interfaceElement.allSupertypes .map((e) => InternalDeclarationUtils.getIdFromElement(e.element)) - .whereNotNull() + .nonNulls .toList(), ); From edd4e17af813f431458383ec600533460c535768 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 08:44:42 +0200 Subject: [PATCH 8/9] remove unused import --- lib/src/model/internal/internal_interface_declaration.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/src/model/internal/internal_interface_declaration.dart b/lib/src/model/internal/internal_interface_declaration.dart index 27cdb37..2802840 100644 --- a/lib/src/model/internal/internal_interface_declaration.dart +++ b/lib/src/model/internal/internal_interface_declaration.dart @@ -1,5 +1,4 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:collection/collection.dart'; import '../interface_declaration.dart'; import '../executable_declaration.dart'; From e34f409c6f841006eabe022033899c39f1cc2cc9 Mon Sep 17 00:00:00 2001 From: devmil Date: Mon, 15 Jul 2024 09:02:03 +0200 Subject: [PATCH 9/9] fix "withNullability" deprecation the other way around (default now is withNullability=true) --- .../model/internal/internal_declaration_utils.dart | 14 +------------- .../internal/internal_executable_declaration.dart | 9 ++------- .../model/internal/internal_field_declaration.dart | 4 +--- .../internal/internal_type_alias_declaration.dart | 4 +--- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/lib/src/model/internal/internal_declaration_utils.dart b/lib/src/model/internal/internal_declaration_utils.dart index 88b194c..29d2fea 100644 --- a/lib/src/model/internal/internal_declaration_utils.dart +++ b/lib/src/model/internal/internal_declaration_utils.dart @@ -1,5 +1,4 @@ import 'package:analyzer/dart/element/element.dart'; -import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:path/path.dart' as path; @@ -23,20 +22,9 @@ abstract class InternalDeclarationUtils { return typeParameters.map((e) => e.name).toList(); } - static String getNullabilitySuffixString( - NullabilitySuffix nullabilitySuffix) { - return switch (nullabilitySuffix) { - NullabilitySuffix.none => '', - NullabilitySuffix.question => '?', - NullabilitySuffix.star => '*', - }; - } - static Set computeSuperTypeNames(List allSupertypes) { return allSupertypes - .map((st) => - st.getDisplayString() + - getNullabilitySuffixString(st.nullabilitySuffix)) + .map((st) => st.getDisplayString()) // if there are supertypes with the same name then only one survives // this is accepted for now as we don't want to dig that far into type hierarchy changes .toSet(); diff --git a/lib/src/model/internal/internal_executable_declaration.dart b/lib/src/model/internal/internal_executable_declaration.dart index 7a92093..c5a06eb 100644 --- a/lib/src/model/internal/internal_executable_declaration.dart +++ b/lib/src/model/internal/internal_executable_declaration.dart @@ -51,10 +51,7 @@ class InternalExecutableDeclaration implements InternalDeclaration { id: InternalDeclarationUtils.getIdFromElement(executableElement)!, parentClassId: InternalDeclarationUtils.getIdFromParentElement( executableElement.enclosingElement), - returnTypeName: executableElement.returnType.getDisplayString() + - InternalDeclarationUtils.getNullabilitySuffixString( - executableElement.returnType.nullabilitySuffix, - ), + returnTypeName: executableElement.returnType.getDisplayString(), returnTypeFullLibraryName: executableElement.returnType.element?.librarySource?.fullName, name: executableElement.displayName, @@ -114,9 +111,7 @@ class InternalExecutableDeclaration implements InternalDeclaration { name: e.name, isDeprecated: e.hasDeprecated, isExperimental: InternalDeclarationUtils.hasExperimental(e), - typeName: e.type.getDisplayString() + - InternalDeclarationUtils.getNullabilitySuffixString( - e.type.nullabilitySuffix), + typeName: e.type.getDisplayString(), typeFullLibraryName: e.type.element?.librarySource?.fullName, relativePath: relativePath, )) diff --git a/lib/src/model/internal/internal_field_declaration.dart b/lib/src/model/internal/internal_field_declaration.dart index dc35ce3..a068816 100644 --- a/lib/src/model/internal/internal_field_declaration.dart +++ b/lib/src/model/internal/internal_field_declaration.dart @@ -51,9 +51,7 @@ class InternalFieldDeclaration implements InternalDeclaration { id: InternalDeclarationUtils.getIdFromElement(fieldElement)!, parentClassId: InternalDeclarationUtils.getIdFromParentElement( fieldElement.enclosingElement), - typeName: fieldElement.type.getDisplayString() + - InternalDeclarationUtils.getNullabilitySuffixString( - fieldElement.type.nullabilitySuffix), + typeName: fieldElement.type.getDisplayString(), typeFullLibraryName: fieldElement.type.element?.librarySource?.fullName, name: fieldElement.name, diff --git a/lib/src/model/internal/internal_type_alias_declaration.dart b/lib/src/model/internal/internal_type_alias_declaration.dart index 3643879..905e9e3 100644 --- a/lib/src/model/internal/internal_type_alias_declaration.dart +++ b/lib/src/model/internal/internal_type_alias_declaration.dart @@ -43,9 +43,7 @@ class InternalTypeAliasDeclaration implements InternalDeclaration { typeAliasElement.enclosingElement), name: typeAliasElement.name, namespace: namespace, - aliasedTypeName: typeAliasElement.aliasedType.getDisplayString() + - InternalDeclarationUtils.getNullabilitySuffixString( - typeAliasElement.aliasedType.nullabilitySuffix), + aliasedTypeName: typeAliasElement.aliasedType.getDisplayString(), isDeprecated: typeAliasElement.hasDeprecated, isExperimental: InternalDeclarationUtils.hasExperimental(typeAliasElement),