[jni] `PortProxyBuilder$DartException` extends checked `Exception`

Open Beginner friendly
#3,877 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
dart, java

Research direction

Start with pkgs/jni/java/src/main/java/com/github/dart_lang/jni/PortProxyBuilder.java, where DartException is defined, and verify the reported behavior for a Dart callback invoked through a Java interface method without a throws declaration. Then document that UndeclaredThrowableException can have a null message; done means the behavior and its cause are clearly documented. The possible RuntimeException change is only a consideration for 2.0.

Written by the indexing model from the issue text.

Description

lang-java needs-triage package:jni package:jni_flutter package:jnigen

PortProxyBuilder$DartException extends checked Exception.

When a Dart callback throws inside a Java interface method that doesn't declare throws Exception, java.lang.reflect.Proxy wraps DartException in UndeclaredThrowableException, whose getMessage() is null.

We should document this clearly now, and consider changing DartException to extend RuntimeException in 2.0.

Split out from #3836.

Note: This bug is AI generated. I've reviewed it and it makes sense, but I haven't attempted to repro. Make sure the bug repros before trying to fix it.

Dominant language
Dart
Stars
280
Forks
166
Avg merge
3d 1h
Merged PRs (30d)
35

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dart-lang/native

All issues in dart-lang/native

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.