Skip to content

Cleanup a number of warnings in the code. #137

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

Merged
merged 11 commits into from
Dec 4, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ private ListenerRegistration addSnapshotListenerInternal(
}

@Override
@SuppressWarnings("EqualsGetClass") // This class is effectively final.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why not use instanceof here and in Query#equals? The article you linked states that instanceof is never worse than getClass:

What about final or effectively-final classes?

In this case there is no disadvantage to the getClass trick - but there’s no great advantage to it either. Most unsafe idioms have circumstances in which they are safe, but this doesn’t change the fact that they are generally unsafe and not worth propagating and legitimizing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, done.

public boolean equals(Object o) {
if (this == o) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ private ListenerRegistration addSnapshotListenerInternal(
}

@Override
@SuppressWarnings("EqualsGetClass") // This class is effectively final.
public boolean equals(Object o) {
if (this == o) {
return true;
Expand Down