Skip to content

[pigeon] Removes the @protected annotation from the InstanceManager field of the PigeonInternalProxyApiBaseClass #8125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 22.6.2

* Removes the `@protected` annotation from the InstanceManager field of the
`PigeonInternalProxyApiBaseClass`.

## 22.6.1

* [gobject] Moves class declarations to the header to work around a bug in some
Expand Down
1 change: 0 additions & 1 deletion packages/pigeon/lib/dart/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ abstract class $proxyApiBaseClassName {
final BinaryMessenger? $_proxyApiBaseClassMessengerVarName;

/// Maintains instances stored to communicate with native language objects.
@protected
final $dartInstanceManagerClassName $_proxyApiBaseClassInstanceManagerVarName;

/// Instantiates and returns a functionally identical object to oneself.
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'ast.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '22.6.1';
const String pigeonVersion = '22.6.2';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ abstract class PigeonInternalProxyApiBaseClass {
final BinaryMessenger? pigeon_binaryMessenger;

/// Maintains instances stored to communicate with native language objects.
@protected
final PigeonInstanceManager pigeon_instanceManager;

/// Instantiates and returns a functionally identical object to oneself.
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
version: 22.6.1 # This must match the version in lib/generator_tools.dart
version: 22.6.2 # This must match the version in lib/generator_tools.dart

environment:
sdk: ^3.3.0
Expand Down
56 changes: 56 additions & 0 deletions packages/pigeon/test/dart/proxy_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,62 @@ void main() {
);
});

group('ProxyApi base class', () {
test('class name', () {
final Root root = Root(apis: <Api>[
AstProxyApi(
name: 'Api',
constructors: <Constructor>[],
fields: <ApiField>[],
methods: <Method>[],
)
], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
const DartGenerator generator = DartGenerator();
generator.generate(
const DartOptions(),
root,
sink,
dartPackageName: DEFAULT_PACKAGE_NAME,
);
final String code = sink.toString();

expect(
code,
contains(r'abstract class PigeonInternalProxyApiBaseClass'),
);
});

test('InstanceManager field', () {
final Root root = Root(apis: <Api>[
AstProxyApi(
name: 'Api',
constructors: <Constructor>[],
fields: <ApiField>[],
methods: <Method>[],
)
], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
const DartGenerator generator = DartGenerator();
generator.generate(
const DartOptions(),
root,
sink,
dartPackageName: DEFAULT_PACKAGE_NAME,
);
final String code = sink.toString();
final String collapsedCode = _collapseNewlineAndIndentation(code);

expect(
collapsedCode,
contains(
'/// Maintains instances stored to communicate with native language objects. '
'final PigeonInstanceManager pigeon_instanceManager;',
),
);
});
});

group('inheritance', () {
test('extends', () {
final AstProxyApi api2 = AstProxyApi(
Expand Down