Skip to content

Conversation

@alexmenkov
Copy link

@alexmenkov alexmenkov commented Dec 20, 2025

The fix resolves disabled warnings in debugger agent


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8374168: Resolve disabled warnings in JDWP agent (Sub-task - P4)

Reviewers

Reviewers without OpenJDK IDs

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28937/head:pull/28937
$ git checkout pull/28937

Update a local copy of the PR:
$ git checkout pull/28937
$ git pull https://git.openjdk.org/jdk.git pull/28937/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28937

View PR using the GUI difftool:
$ git pr show -t 28937

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28937.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 20, 2025

👋 Welcome back amenkov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 20, 2025

@alexmenkov This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8374168: Resolve disabled warnings in JDWP agent

Reviewed-by: cjplummer, sspitsyn, erikj

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 84 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Dec 20, 2025

@alexmenkov The following labels will be automatically applied to this pull request:

  • build
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 20, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 20, 2025

Webrevs

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 22, 2025
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Posted one nit.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Dec 23, 2025
Comment on lines 184 to 189
jvmtiCompileTimeMajorVersion = ((int)JVMTI_VERSION & (int)JVMTI_VERSION_MASK_MAJOR)
>> (int)JVMTI_VERSION_SHIFT_MAJOR;
jvmtiCompileTimeMinorVersion = ((int)JVMTI_VERSION & (int)JVMTI_VERSION_MASK_MINOR)
>> (int)JVMTI_VERSION_SHIFT_MINOR;
jvmtiCompileTimeMicroVersion = ((int)JVMTI_VERSION & (int)JVMTI_VERSION_MASK_MICRO)
>> (int)JVMTI_VERSION_SHIFT_MICRO;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the need for this. These types are all naturally jints, so I'm not sure why you would need to cast them here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
    }
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, no warnings for JvmtiExport::decode_version_values()

JvmtiExport::decode_version_values(jint version, int * major, int * minor,
int * micro) {
*major = (version & JVMTI_VERSION_MASK_MAJOR) >> JVMTI_VERSION_SHIFT_MAJOR;
*minor = (version & JVMTI_VERSION_MASK_MINOR) >> JVMTI_VERSION_SHIFT_MINOR;
*micro = (version & JVMTI_VERSION_MASK_MICRO) >> JVMTI_VERSION_SHIFT_MICRO;
}

where the version is a jint.
And jint does seem like the natural type here.

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates. Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 23, 2025
Copy link
Member

@erikj79 erikj79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build change looks good.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Dec 23, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 23, 2025
@alexmenkov
Copy link
Author

alexmenkov commented Dec 23, 2025

With the latest version GHA Windows-x64 build still fails:
debugInit.c
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(184): error C2220: the following warning is treated as an error
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(184): warning C5287: operands are different enum types '<unnamed-enum-JVMTI_VERSION_1>' and '<unnamed-enum-JVMTI_VERSION_MASK_INTERFACE_TYPE>'; use an explicit cast to silence this warning
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(184): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(186): warning C5287: operands are different enum types '<unnamed-enum-JVMTI_VERSION_1>' and '<unnamed-enum-JVMTI_VERSION_MASK_INTERFACE_TYPE>'; use an explicit cast to silence this warning
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(186): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(188): warning C5287: operands are different enum types '<unnamed-enum-JVMTI_VERSION_1>' and '<unnamed-enum-JVMTI_VERSION_MASK_INTERFACE_TYPE>'; use an explicit cast to silence this warning
d:\a\jdk\jdk\src\jdk.jdwp.agent\share\native\libjdwp\debugInit.c(188): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings

@alexmenkov
Copy link
Author

Looks like this is a bug in MSVC: https://developercommunity.visualstudio.com/t/warning-C5287:-operands-are-different-e/10877942
cast to signed 32bit integer does not silence the warning.
I think the simplest would be to cast to unsigned int

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Dec 23, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review serviceability [email protected]

Development

Successfully merging this pull request may close these issues.

6 participants