Skip to content
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

Enable NarrowingCompoundAssignment error-prone check #18466

Conversation

findepi
Copy link
Member

@findepi findepi commented Jul 31, 2023

Compound assignment with wider type on the right-hand-side is a silent truncation.

@findepi findepi added the no-release-notes This pull request does not require release notes entry label Jul 31, 2023
@cla-bot cla-bot bot added the cla-signed label Jul 31, 2023
In some places it's `double` and sometimes it's `long`.
Since it is integral over time, it should be represented as `double` to
avoid numeric overflow.
@findepi findepi force-pushed the findepi/enable-narrowingcompoundassignment-error-prone-check-d9fcd2 branch from 67d58db to 7c32011 Compare July 31, 2023 12:20
findepi added 3 commits July 31, 2023 14:48
`io.trino.orc.writer.ColumnWriter#getBufferedBytes` returns a `long`
even though the amount of buffered bytes should not be more than 2 GB.
Use `long` in other places too to avoid numeric overflows.
@findepi findepi force-pushed the findepi/enable-narrowingcompoundassignment-error-prone-check-d9fcd2 branch from 45d4633 to c63db9b Compare July 31, 2023 13:34
findepi added 2 commits July 31, 2023 16:11
In Java, compound assignment with wider type on the right-hand-side is a
silent truncation.

This enables error-prone check for such cases and refactors code to make
it compliant. Some places are updated based solely on the assumption
that they weren't incorrect.
@findepi findepi force-pushed the findepi/enable-narrowingcompoundassignment-error-prone-check-d9fcd2 branch from c63db9b to 1ced132 Compare July 31, 2023 14:15
@findepi findepi merged commit 0de0b5c into trinodb:master Aug 1, 2023
@findepi findepi deleted the findepi/enable-narrowingcompoundassignment-error-prone-check-d9fcd2 branch August 1, 2023 08:44
@github-actions github-actions bot added this to the 423 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

2 participants