RFR: 8351542: LIBMANAGEMENT_OPTIMIZATION remove special optimization settings [v2]

Matthias Baesken mbaesken at openjdk.org
Tue Mar 11 13:59:59 UTC 2025


On Tue, 11 Mar 2025 13:36:42 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> src/java.management/share/native/libmanagement/VMManagementImpl.c line 63:
>> 
>>> 61: {
>>> 62:     jmmOptionalSupport mos;
>>> 63:     jmm_interface->GetOptionalSupport(env, &mos);
>> 
>> Is it worth making any change here?
>> 
>> We currently ignore the return value from GetOptionalSupport, and no doubt have done for years.
>> So is the fix to just not record the return value, or should we check it?
>> 
>> Making a change to not capture the return value looks like a statement that it should never be checked.  Even if GetOptionalSupport "can't" really fail with the current implementation, that doesn't seem like the right hint to leave.
>> 
>> Other usage in Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommandInfo
>> also does:
>>  jint ret = jmm_interface_management_ext->GetOptionalSupport(env, &mos);
>>  
>> ...and also doesn't check the return value.
>
>> Is it worth making any change here?
> 
> This was needed because I removed
> DISABLED_WARNINGS_gcc_VMManagementImpl.c
> while changing the makefile.

> Other usage in Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommandInfo also does: jint ret = jmm_interface_management_ext->GetOptionalSupport(env, &mos);
> 
> ...and also doesn't check the return value.

Seems this one needs the warning disabling because of the unused variable
DISABLED_WARNINGS_gcc_DiagnosticCommandImpl.c := unused-variable

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23966#discussion_r1989338573


More information about the build-dev mailing list