RFR: 8308780: Fix the Java Integer types on Windows

Julian Waters jwaters at openjdk.org
Thu May 25 09:25:59 UTC 2023


On Wed, 24 May 2023 13:56:05 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

For reference as to what types the calls in affected code accepts as parameters, so any future reviews don't need to dig through the code

GDIRenderer.cpp:

- Java_sun_java2d_windows_GDIRenderer_doFillArc
  * AngleToCoord takes jints as arguments
  * ::Pie takes ints as arguments

- Java_sun_java2d_windows_GDIRenderer_doDrawArc
  * AngleToCoord takes jints as arguments
  * ::Arc takes ints as arguments

GDIWindowSurfaceData.cpp:

- GDIWinSD_GetRasInfo
  * SurfaceDataRasInfo's lutBase field is a jint*

awt_MenuBar.cpp (Encompasses the changes in awt_Menu.h and awt_MenuBar.h as well):

- AwtMenuBar::GetItem passes the only relevant jint (formerly long) into env->CallObjectMethod()

AccessInfo.cpp

- getAccessibleInfo
  * start and end (both formerly long) are both passed to GetAccessibleTextLineBounds and GetAccessibleTextRange which take jints


Only outlier is jaccesswalker, which I think I may have edited wrongly

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

PR Comment: https://git.openjdk.org/jdk/pull/14125#issuecomment-1562575536


More information about the core-libs-dev mailing list