-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove 'throws Exception' from Pointer::close #86
Remove 'throws Exception' from Pointer::close #86
Conversation
Pointer throws a RuntimeException on close. Removing the throws allows the user's try-with-resource blocks not require a catch(Exception)
I've thought about that myself, but if we do that, then it becomes impossible to override the On the other hand, it is possible to override the public NoThrowClass extends Pointer {
@Override public void close() { super.close(); }
} public CustomThrowClass extends Pointer {
@Override public void close() throws CustomException { super.close(); }
} |
I see your point and that adding this could be a breaking change. My reasoning was that A custom class could override The @Override
void close() {
try {
super.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
} |
Right,
Not so bad if we needed it I thought. |
It's a bit like the case of the |
Well not calling |
I've given this some more thoughts. Since |
* Remove `throws Exception` from `Pointer.close()`
Pointer throws a RuntimeException on close. Removing the throws
allows the user's try-with-resource blocks not require a catch(Exception)