On Tue, 17 May 2022 13:54:59 GMT, Yasumasa Suenaga <[email protected]> wrote:
>> You forced me to look at this in depth. The values are set via the build
>> system. In the build system it is impossible to get just -J because the -J
>> is only added as a prefix for an existing string. So basically this is
>> impossible code to reach unless you manually override the build system
>> definition. So as far as I can see this is a classic case where we want an
>> assert.
>>
>>
>> if (arg[0] == '-' && arg[1] == 'J') {
>> assert(arg[2] != '\0', "Invalid JAVA_ARGS or EXTRA_JAVA_ARGS defined by
>> build");
>> *nargv++ = JLI_StringDup(arg + 2);
>> }
>
> @dholmes-ora Thanks for your comment!
>
> We cannot use `assert(cond, message)` at here because it is not HotSpot code.
> In imageFile.cpp for libjimage. It uses `assert(cond && message)`, so I use
> this style in new commit, and the warning has gone.
>
> I can change to "normal" `assert` usage at here if it is strange.
@YaSuenag I know this is not hotspot code. Please see existing use of assert in
related code i.e. src/java.base/share/native/libjli/args.c
-------------
PR: https://git.openjdk.java.net/jdk/pull/8694