-
Notifications
You must be signed in to change notification settings - Fork 68
[jnigen] Support use
arenas on nullable JObjects
#2239
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
Conversation
use
arenas on nullable JObjectsuse
arenas on nullable JObjects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use
method has existed for a while however I don't really recommend using it anymore (due to excessive nesting as you mentioned). We might even be fine with removing it eventually for 1.0. Instead use using
:
using((arena) {
final foo = Foo()..releasedBy(arena);
final bar = Bar(foo)..releasedBy(arena);
});
// Now both foo and bar are released and we didn't have to nest twice.
I'm fine with landing your change though for now once you fix the test and add a changelog entry.
What should the wip header of the changelog be? |
Actually, it's not a big change. So let's ignore the changelog. |
PR Health
Breaking changes
|
Package | Change | Current Version | New Version | Needed Version | Looking good? |
---|---|---|---|---|---|
jni | Breaking | 0.14.1 | 0.14.1 | 0.15.0 Got "0.14.1" expected >= "0.15.0" (breaking changes) |
This check can be disabled by tagging the PR with skip-breaking-check
.
Changelog Entry ❗
Package | Changed Files |
---|---|
package:jni | pkgs/jni/lib/src/jobject.dart |
Changes to files need to be accounted for in their respective changelogs.
This check can be disabled by tagging the PR with skip-changelog-check
.
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 | _ReferenceType _opaque_pthread_mutex_t _opaque_pthread_cond_t _Dart_FinalizableHandle |
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 |
Please run dart format on the test to satisfy the CI! |
Done |
analyze_jni step fails:
|
@HosseinYousefi Sorry that this became this many tries on my part. |
LGTM! Thanks! |
The
use
method makes it really easy to use jni and not worry about memory management (even if the nesting get's ugly)However this PR allows you to use
use
on nullableJObject?
s too.This is a very small pr which would allow you to do this.
The extension was only on
JObject
previosly.Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.