Skip to content

[jnigen] Export and document j_elements.dart#3356

Merged
liamappelbe merged 8 commits into
mainfrom
jnigen_visitor
May 18, 2026
Merged

[jnigen] Export and document j_elements.dart#3356
liamappelbe merged 8 commits into
mainfrom
jnigen_visitor

Conversation

@liamappelbe

@liamappelbe liamappelbe commented May 12, 2026

Copy link
Copy Markdown
Contributor
  • Export and document the classes in j_elements.dart, so that users can write custom visitors.
    • Make Element private, and delete Classes.let
  • This caused export conflicts because we were exporting elements.dart, which has a bunch of AST elements with the same names as the ones in j_elements.dart.
    • elements.dart conceptually should be private. It was exported because Config.importedClasses uses it. So I made Config.importedClasses private.
    • But it (and importClasses()) are needed by other files in JNIgen. So I moved them to an extension method, ConfigInternal, which is hidden when config_types.dart is exported . That way internal uses of Config can see the method, but external users can't.

Fixes #2962

@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
jni None 1.0.0 1.0.1-wip 1.0.1-wip ✔️
jni_flutter None 1.0.1 1.0.1 1.0.1 ✔️

This check can be disabled by tagging the PR with skip-breaking-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 symbol Leaking sources
jni $JCollection core_bindings.dart::JCollection::implementIn::$impl
core_bindings.dart::JCollection::implement::$impl
jni $JIterator core_bindings.dart::JIterator::implementIn::$impl
core_bindings.dart::JIterator::implement::$impl
jni $JList core_bindings.dart::JList::implementIn::$impl
core_bindings.dart::JList::implement::$impl
jni $JMap$JEntry core_bindings.dart::JMap$JEntry::implementIn::$impl
core_bindings.dart::JMap$JEntry::implement::$impl
jni $JMap core_bindings.dart::JMap::implementIn::$impl
core_bindings.dart::JMap::implement::$impl
jni $JSet core_bindings.dart::JSet::implementIn::$impl
core_bindings.dart::JSet::implement::$impl

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

@liamappelbe liamappelbe requested a review from dcharkes May 12, 2026 05:02
@liamappelbe liamappelbe marked this pull request as ready for review May 12, 2026 05:02
@liamappelbe liamappelbe changed the title WIP [jnigen] Export and document j_elements.dart [jnigen] Export and document j_elements.dart May 12, 2026

@dcharkes dcharkes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a test somewhere with a user-defined visitor for sanity?

@liamappelbe

Copy link
Copy Markdown
Contributor Author

Should we have a test somewhere with a user-defined visitor for sanity?

We have a user_visitor_test. There's also jni/tool/generate_jni_bindings, which uses custom visitors. I've migrated both to only import jnigen.dart, not j_elements.dart.

@liamappelbe liamappelbe merged commit 10b2ced into main May 18, 2026
62 of 64 checks passed
@liamappelbe liamappelbe deleted the jnigen_visitor branch May 18, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jnigen] Visitors appear to be undocumented and private

2 participants