On Tue, 23 Dec 2025 02:46:25 GMT, Chris Plummer <[email protected]> wrote:

>> These are enums (i.e. ints) , GHA on Windows fail because they are 3 
>> different enum types (warning 5287)
>> For unknown reason (different MSVC version maybe) my local Windows build and 
>> our CI passed
>
>> These are enums (i.e. ints) , GHA on Windows fail because they are 3 
>> different enum types (warning 5287)
>> For unknown reason (different MSVC version maybe) my local Windows build and 
>> our CI passed
> 
> This code that we have elsewhere in the debug agent seems to compile ok. 
> Perhaps all that is needed is a cast of JVMTI_VERSION to jint:
> 
> 
> static jboolean isVersionGte12x() {
>     jint version;
>     jvmtiError err =
>         JVMTI_FUNC_PTR(gdata->jvmti,GetVersionNumber)(gdata->jvmti, &version);
> 
>     if (err == JVMTI_ERROR_NONE) {
>         jint major, minor;
> 
>         major = (version & JVMTI_VERSION_MASK_MAJOR)
>                     >> JVMTI_VERSION_SHIFT_MAJOR;
>         minor = (version & JVMTI_VERSION_MASK_MINOR)
>                     >> JVMTI_VERSION_SHIFT_MINOR;
>         return (major > 1 || (major == 1 && minor >= 2)) ? JNI_TRUE : 
> JNI_FALSE;
>     } else {
>         return JNI_FALSE;
>     }
> }

Similarly, no warnings for `JvmtiExport::decode_version_values()`
https://github.com/openjdk/jdk/blob/e1d81c0946364a266a006481a8fbbac24c7e6c6a/src/hotspot/share/prims/jvmtiExport.cpp#L643-L648
where the version is a `jint`.
And `jint` does seem like the natural type here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28937#discussion_r2642993146

Reply via email to