Skip to content

[jnigen] Propagate Javadoc deprecation messages#3475

Open
Siya-05 wants to merge 1 commit into
dart-lang:mainfrom
Siya-05:jnigen-javadoc-deprecation
Open

[jnigen] Propagate Javadoc deprecation messages#3475
Siya-05 wants to merge 1 commit into
dart-lang:mainfrom
Siya-05:jnigen-javadoc-deprecation

Conversation

@Siya-05

@Siya-05 Siya-05 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is a follow-up to #3429 and addresses part of #2796.

The previous PR generated Dart @Deprecated annotations for Java methods annotated with java.lang.Deprecated, using a generic deprecation message.

This PR propagates the Java @deprecated Javadoc message into the generated Dart @Deprecated(...) annotation when bindings are generated with the doclet backend, providing developers with the original deprecation guidance from the Java source.

When Javadocs are unavailable (for example, when using the ASM backend), the generator continues to fall back to the generic "This Java method is deprecated." message.

Changes

  • Add a JavaDocComment.deprecatedMessage helper to extract the @deprecated Javadoc message.
  • Generate Dart @Deprecated(...) annotations using the extracted Javadoc message when available.
  • Preserve the existing generic fallback message when Javadocs are unavailable.
  • Update the simple_package test fixture with a Javadoc deprecation message.

Related Issues

Addresses part of #2796.

PR Checklist

  • I’ve reviewed the [contributor guide](https://github.com/dart-lang/native/blob/main/CONTRIBUTING.md) and applied the relevant portions to this PR.
  • I've run dart tool/ci.dart --all locally and resolved all issues identified. This ensures the PR is formatted, has no lint errors, and ran all code generators. This applies to the packages part of the toplevel pubspec.yaml workspace.
  • All existing tests are passing.
  • The PR addresses the requested follow-up by propagating the Java @deprecated Javadoc message into generated Dart @Deprecated(...) annotations.
  • I have updated CHANGELOG.md for the relevant packages. (Not needed for small changes such as doc typos.)
  • I have updated the pubspec package version if necessary.

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.

1 participant