Skip to content

FINERACT-822 Enable Warnings CompareToZero#951

Merged
vorburger merged 1 commit intoapache:developfrom
percyashu:FINERACT-822
Jun 1, 2020
Merged

FINERACT-822 Enable Warnings CompareToZero#951
vorburger merged 1 commit intoapache:developfrom
percyashu:FINERACT-822

Conversation

@percyashu
Copy link
Contributor

@percyashu percyashu commented May 29, 2020

@percyashu
Copy link
Contributor Author

@vorburger, @awasum, @xurror LGTY?

@percyashu percyashu changed the title FINERACT-822 Enable CompareToZero check FINERACT-822 Enable Warnings May 29, 2020
@percyashu percyashu force-pushed the FINERACT-822 branch 3 times, most recently from 80cf392 to ab7b4e7 Compare May 30, 2020 16:11
Copy link
Contributor

@xurror xurror left a comment

Choose a reason for hiding this comment

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

I'm seeing you are enabling many checks at once. I would propose you instead raise small PRs for each of them. It will become a real PITA to review this if to files and changes done here. Is that OK for you?

@percyashu
Copy link
Contributor Author

OK will revert to the first commit

@percyashu percyashu changed the title FINERACT-822 Enable Warnings FINERACT-822 Enable Warnings CompareToZero May 30, 2020
Copy link
Member

Choose a reason for hiding this comment

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

Just curious of this change, @percyashu can you please tell why they mean the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Always comparing to 0 is the safest use of the return value when using compareTo since the magnitude of the value return is not certain but the sign is. See https://errorprone.info/bugpattern/CompareToZero

Copy link
Member

Choose a reason for hiding this comment

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

This is actually "fun"... I also had to read https://errorprone.info/bugpattern/CompareToZero - and now I understand it. What's really interesting and not just fun is that in N places of this PR you're just doing something to make EP happy, but in exactly 4 occurrences, you've actually just fixed real bugs - see FINERACT-1014; thank You, Error Prone!

Copy link
Member

Choose a reason for hiding this comment

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

@vorburger @percyashu this is interesting!

@vorburger
Copy link
Member

/rebase

@vorburger
Copy link
Member

The build failure here was "just" due to the (very interesting!) finding of @ptuomola in FINERACT-885.

FINERACT-1014 explains how this PR isn't only "nice", but actually fixes real bugs in API validation .

@vorburger vorburger merged commit aed3e41 into apache:develop Jun 1, 2020
if (this.status != null) {
if ((Double) this.status.get("id") >= 0) {
hash += (Double) this.status.get("id");
hash = (int) (hash + (Double) this.status.get("id"));
Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants