On Tue, 18 Jan 2022 19:36:18 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> While working on JDK-8280003, I noticed that 
>> java/lang/instrument/GetObjectSizeIntrinsicsTest.java does not test arrays 
>> with more than 1-byte size elements, and no large arrays (past 4G limit) are 
>> tested either. It would be better to add those test cases. 
>> 
>> Additional testing:
>>  - [x] Linux x86_64 fastdebug, affected test still passes
>>  - [x] Linux x86_32 fastdebug, affected test still passes
>>  - [x] Linux AArch64 fastdebug, affected test still passes
>>  - [x] Linux PPC64 fastdebug, affected test still passes
>
> test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java line 326:
> 
>> 324: 
>> 325:     public static void main(String[] args)throws Throwable {
>> 326:         new GetObjectSizeIntrinsicsTest(args[0], (args.length >= 2 ? 
>> args[1] : "")).runTest();
> 
> Shouldn't this be `args.length == 2`?

`>= 2` is more future-proof, I think, as it checks that _at least_ two 
arguments exists, which allows to read `args[1]`. Accidental addition of third 
argument would not silently break the test.

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

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

Reply via email to