Skip to content
New issue

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

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

Already on GitHub? # to your account

[jnigen] Include superinterface methods #2013

Merged
merged 6 commits into from
Feb 20, 2025

Conversation

HosseinYousefi
Copy link
Member

@HosseinYousefi HosseinYousefi commented Feb 18, 2025

Closes #577.

  • Adds the ability to clone various Elements in different stages of the code generation. Since the properties of the AST are added in multiple steps, the clone method gets an enum GenerationStage until and fills the values that are available until that stage.
  • Copies the methods from the super-interfaces to the class.
  • For generics like Foo<T>, Bar implements Foo<String> should have the methods of Foo, however all of the instances of T would have to be converted to String. _MethodMover in linker.dart handles this part.
  • Merged Descriptor into Linker since we need it to distinguish between duplicate methods.
    • Technically the bytecode parser already has the descriptors, this is only a problem in the source parser where we generate the method descriptors in JNIgen.

Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
jni None 0.14.0 0.14.1-wip 0.14.0 ✔️
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

API leaks ⚠️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
jni _opaque_pthread_mutex_t
_opaque_pthread_cond_t
_Dart_FinalizableHandle
_ReferenceType

This check can be disabled by tagging the PR with skip-leaking-check.

License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@HosseinYousefi HosseinYousefi force-pushed the include-methods-interfaces branch from a7fe5f9 to 602bd58 Compare February 18, 2025 21:56
@HosseinYousefi HosseinYousefi marked this pull request as draft February 18, 2025 22:02
@HosseinYousefi HosseinYousefi marked this pull request as ready for review February 19, 2025 02:57
@coveralls
Copy link

coveralls commented Feb 19, 2025

Coverage Status

coverage: 81.519% (-0.006%) from 81.525%
when pulling 9e82b25 on include-methods-interfaces
into 2bc6d8d on main.

@HosseinYousefi
Copy link
Member Author

Added a mixin on the top-level visitors, so the wrapper function only gets the visitor and checks if the stage is exactly previous stage + 1.

mixin TopLevelVisitor<R> on Visitor<Classes, R> {
  GenerationStage get stage;
}

@HosseinYousefi HosseinYousefi merged commit 8ca82ba into main Feb 20, 2025
26 of 27 checks passed
@HosseinYousefi HosseinYousefi deleted the include-methods-interfaces branch February 20, 2025 09:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include non-overriden inherited methods
4 participants