facebookincubator / fbjni

A library designed to simplify the usage of the Java Native Interface
Apache License 2.0
266 stars 47 forks source link

Make Java common used exceptions public for users. #60

Open psionic12 opened 3 years ago

psionic12 commented 3 years ago

Some Java codes take an exception as a parameter (e.g. public void callFailed(Call call, IOException ioe) in okhttp)

Make JXXExceptions public to save time.

facebook-github-bot commented 3 years ago

@passy has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

dreiss commented 3 years ago

Does it make sense to add java.lang.Exception, for completeness, and have most of these extend that, rather than Throwable?

Does it make sense to move these to Exceptions.h?

ArrayIndexOutOfBounds exception should extend RuntimeException, rather than throwable.

psionic12 commented 3 years ago

While this pr are not intended to change fbjni too much, just expose the predefined exception for an easy use. What you mentioned sound reasonable but need a fully discussion with other fbjni members, I guess.

dreiss commented 3 years ago

just expose the predefined exception for an easy use

The issue here is that there are some deficiencies in the existing implementations that didn't cause any problems with the specific ways they were being used, but that should be cleaned up before we make them available as general-purpose utilities for consumers.

need a fully discussion with other fbjni members

These suggestions were made internally by Marc Horowitz, and I agree with them. That's more than enough fbjni members to approve this change. :)

facebook-github-bot commented 3 years ago

@psionic12 has updated the pull request. You must reimport the pull request before landing.

psionic12 commented 3 years ago

@dreiss Done.