Skip to content

[jnigen] adding the ability for the user to rename - #1946

Merged
HosseinYousefi merged 5 commits into
dart-lang:mainfrom
marshelino-maged:Ability-to-rename
Jan 31, 2025
Merged

HosseinYousefi merged 5 commits into
dart-lang:mainfrom
marshelino-maged:Ability-to-rename

Conversation

@marshelino-maged

@marshelino-maged marshelino-maged commented Jan 27, 2025 •

Copy link
Copy Markdown
Contributor
  • Adding the ability for the user to rename classes, fields, methods and parameters.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

commit 92d2a8d
Author: Marshelino Maged <[email protected]>
Date:   Mon Jan 27 21:17:25 2025 +0200

    ability for the user to rename

commit eec4f6e
Author: Marshelino Maged <[email protected]>
Date:   Mon Jan 27 20:38:36 2025 +0200

    edit test

commit 24453db
Author: Marshelino Maged <[email protected]>
Date:   Mon Jan 27 19:30:11 2025 +0200

    enable user to rename
@marshelino-maged marshelino-maged changed the title [jnigen] adding the ability to the user to rename [jnigen] adding the ability for the user to rename Jan 27, 2025
@HosseinYousefi
HosseinYousefi self-requested a review January 29, 2025 11:31
@github-actions

Copy link
Copy Markdown

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
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
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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with one very small change.

log.fine('Class ${node.binaryName} is named ${node.finalName}');

if (node.userDefinedName == null ||
node.userDefinedName == node.finalName) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exactly!

void visit(Method node) {
final name = _preprocess(node.isConstructor ? 'new' : node.name);
final name = _preprocess(
node.isConstructor ? 'new' : node.userDefinedName ?? node.name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The user should technically be able to rename the constructors as well, I'm not sure that we currently support this in the dart_generator though. So let's fix that in another PR.

@coveralls

coveralls commented Jan 31, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 81.32% (-0.2%) from 81.484%
when pulling 245bcf3 on marshelino-maged:Ability-to-rename
into cb3cd34 on dart-lang:main.

@HosseinYousefi HosseinYousefi linked an issue Jan 31, 2025 that may be closed by this pull request
@HosseinYousefi
HosseinYousefi merged commit 52f76ad into dart-lang:main Jan 31, 2025
@marshelino-maged
marshelino-maged deleted the Ability-to-rename branch February 4, 2025 19:00
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.

Method / class / field renaming

3 participants