RFR: 8275840: Add test to java/nio/channels/Channels/TransferTo.java to test transfer sizes > 2GB [v2]

Markus KARG duke at openjdk.java.net
Sun Oct 31 17:43:50 UTC 2021


On Sun, 31 Oct 2021 11:34:26 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Also it would be better to use constants.
>>  - It would probably be better to use a try-with-resources statement here to cleanly close the streams.
>
> test/jdk/java/nio/channels/Channels/TransferTo.java line 143:
> 
>> 141:         // writing 3 GB of random bytes into source file
>> 142:         int NUM_WRITES = 3 * 1024;
>> 143:         int BYTES_PER_WRITE = 1024 * 1024;
> 
> We typically do not capitalize local variables, we  capitalize constants(Brian was suggesting the use of constants).
> 
> Using constants adds consistency with their use elsewhere.
> 
> If you choose to use a local variable, the variable name should not be capitalized

Done in https://github.com/openjdk/jdk/pull/6093/commits/126e4877361ac7e3ab82101fee78d7d50c5733ac.

> test/jdk/java/nio/channels/Channels/TransferTo.java line 155:
> 
>> 153: 
>> 154:         // comparing reported transferred bytes, must be 3 GB
>> 155:         assertEquals(count, (long) NUM_WRITES * BYTES_PER_WRITE);
> 
> This could also be a constant (similar to MAX_SIZE_INCR)

Done in https://github.com/openjdk/jdk/pull/6093/commits/126e4877361ac7e3ab82101fee78d7d50c5733ac.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6093


More information about the nio-dev mailing list