RFR: 8308780: Fix the Java Integer types on Windows [v12]

Alexey Ivanov aivanov at openjdk.org
Fri Jun 23 18:05:13 UTC 2023


On Fri, 23 Jun 2023 17:09:12 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> On Windows, the basic Java Integer types are defined as long and __int64 respectively. In particular, the former is rather problematic since it breaks compilation as the Visual C++ becomes stricter and more compliant with every release, which means the way Windows code treats long as a typedef for int is no longer correct, especially with -permissive- enabled. Instead of changing every piece of broken code to match the jint = long typedef, which is far too time consuming, we can instead change jint to an int (which is still the same 32 bit number type as long), as there are far fewer problems caused by this definition. It's better to get this over and done with sooner than later when a future version of Visual C++ finally starts to break on existing code
>
> Julian Waters has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Swap to jint in awt_MenuBar.h
>  - Swap to jint in awt_MenuBar.cpp
>  - Swap to jint in awt_Menu.h

Changes requested by aivanov (Reviewer).

src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp line 1126:

> 1124: 
> 1125:             // Free bitmap buffers if they were allocated
> 1126:             if (colorBits != nullptr) {

Let's revert `nullptr` to `NULL`.

The `NULL` value is used consistently inside `_Win32ShellFolder2_getIconBits` function as well as through out the file, so `nullptr` is out of place.

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

PR Review: https://git.openjdk.org/jdk/pull/14125#pullrequestreview-1495623168
PR Review Comment: https://git.openjdk.org/jdk/pull/14125#discussion_r1240121736


More information about the core-libs-dev mailing list