-
Notifications
You must be signed in to change notification settings - Fork 915
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
Fix testchunkedPackTwoPasses to copy from the bounce buffer #15220
Fix testchunkedPackTwoPasses to copy from the bounce buffer #15220
Conversation
Signed-off-by: Alessandro Bellina <[email protected]>
/ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nit
for (int i = 0; i < longs.length; i++) { | ||
// fill the column and set every other value to null | ||
longs[i] = i % 2 == 0 ? null : (long)i; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since null is the default value for object references we could simply skip even positions
for (int i = 0; i < longs.length; i++) { | |
// fill the column and set every other value to null | |
longs[i] = i % 2 == 0 ? null : (long)i; | |
} | |
// Initialize elements at odd-numbered indices | |
for (int i = 1; i < longs.length; i += 2) { | |
longs[i] = (long)i; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the untouched values of longs
be uninitialized (containing garbage value)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.12.5
Each class variable, instance variable, or array component is initialized with a default value when it is created
...
for all reference types (§4.3), the default value is null.
Signed-off-by: Alessandro Bellina <[email protected]>
/ok to test |
/merge |
This is a follow on from #15210. We bring back the test and fix it so it copies from the right buffer this time. I also set the original column to have some values and nulls, to make sure we are checking something interesting.
Checklist