Exception Wrapper #32
Labels
No Label
1
13
2
21
3
34
5
55
8
bug
core
could have
duplicate
enhancement
help wanted
must have
proc
question
should have
wont have
L
M
S
XL
bug
bugfix
discussion
documentation
feature
maintenance
postponed
refactoring
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: zdm/event-bus#32
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "f/exception-wrapper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #31
There should also be a note inside the README about that.
@ -215,3 +220,3 @@
* @see Event
*/
public void registerListener(Object listener) throws EventBusException {
public void registerListener(Object listener) {
Why did you remove that declaration?
Because we decided against that for our other projects and it also seems to be like this in other big Java projects like Spring. The
@throws
in the Javadoc will stay, though.I think that every exception you explicitly declare via
throw
should also be mentioned inthrows
.I know it is unnecessary for unchecked exceptions.
However, I noticed that whenever I'm not directly in a Giga-IDE such as Eclipse, my first course of action is to look for
throws
in the source code, and not@throws
in the Javadoc, especially as it is often faster to open the source code and look there instead of the javadoc as Javadoc always needs a timeout to plop up, and knowing Eclipse, it sometimes even doesn't plop up. And even if it plops up, you still have to read through the Javadoc, which is also longer than simply looking at the source code.That's why I prefer it that way.
And regarding Spring: Spring is not a project where you should get your styleguides from. Otherwise we also should name our interface implementations
<interface>Impl
or<interface>Spec
. Or have classes such as theMultiPartResolverTestFactoryTest
.In that case, however, the code base would already violate compliance, as we don't declare
throws NullPointerException
for example. Also, we would have to consider all unchecked exceptions potentially thrown by the methods that are called by the method we want to declarethrows
on, which don't follow those conventions themselved. That would be a large and unnecessary effort in my opinion.Why? This is completely arbitrary. So the
NullPointerException
should be removed frmo the Javadoc in that case?I'd say it depends: When you explicitly call
Objects.requireNonNull()
or something similar, then no.I've oversimplified my view point in the previous messages.
I am in favor of explicitly declaring unchecked exceptions, when:
throw
yourselfObjects.requireNonNull
)(i.e. you have two string parameters, of which one is is the complete name of an enum class and the other is the name of one of its constants. Then I would declare the exceptions thrown both from
Class.forName()
and from<enum class>.valueOf()
insidethrows
)I am only in favor of declaring something JVM-internal such as a
NullPointerException
when you're actually doing a null check, and never else.If I were to implement this, multiple other methods in the code base have to be adjusted, as well as their Javadoc. Are you in favor of this?
But first I'm interested in whether @kske overrules me.
@ -0,0 +1,25 @@
package dev.kske.eventbus.core;
One blank line too much
No matter our opinion on throws on unchecked exceptions, the documentation in the README is still needed.
Write that shit yourself.
I dumped that shit on you. Now review it.
@ -0,0 +19,4 @@
* @since 1.2.1
*/
public ExceptionWrapper(Exception cause) {
super(cause);
What I just noticed: Do we want to allow
null
causes?Well, Event Bus doesn't have a problem with it, even though it makes little sense. I would leave it.