JDK-8307160 : Fix AWT/2D/A11Y to support the permissive- flag on the Microsoft Visual C compiler
Type:Enhancement
Component:client-libs
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2023-05-01
Updated:2025-10-28
Resolved:2024-04-05
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
We should fix the AWT codebase to allow compiling with the permissive- flag as suggested by the now backed out JDK-8241499.
Comments
Fix request [21u]
I backport this for parity with 21.0.10-oracle.
Low risk, basically a syntactic change.
Trivial resolve.
SAP nightly testing passed with follow-up JDK-8306579.
27-10-2025
A pull request was submitted for review.
Branch: master
URL: https://git.openjdk.org/jdk21u-dev/pull/2393
Date: 2025-10-25 16:13:04 +0000
A pull request was submitted for review.
URL: https://git.openjdk.org/jdk/pull/18584
Date: 2024-04-02 15:45:59 +0000
03-04-2024
Some explanation of the things that need to change, extracted from a comment in the above PR
====
The changes to awt involve enclosing several areas which make heavy use of goto in scopes to avoid them jumping over the initialization of locals, reordering the order of includes to avoid Microsoft specific headers from using our redefined malloc, moving the definition of C++ static fields outside of extern "C" blocks, and removing the class qualifiers from field declarations in several classes. The last one is fairly obvious - It isn't legal C++ grammar to do so. For the fields that were moved, they have C++ linkage initially by virtue of being static members of a class, but their definitions are inside extern "C" blocks, which causes their linkage to conflict between C++ and C. For the reordering of includes, see my conversation with Thomas - With permissive- enabled C++ templates are properly conforming, and the header comip.h (which is included by comdef.h) uses a templated malloc somewhere, which due to our #define malloc in alloc.h fails since the identifier is obviously not defined. This is actually a major problem that is potentially causing an invisible bug in awt.dll somewhere, aside from it not compiling with permissive-, the redefining of malloc and all other allocators like this is something @tstuefe has expressed some concern over, but I don't really know how to deal with the bigger underlying problem outside of reordering the includes to not let comdef.h use our #define'd malloc. For the enclosing of gotos in scopes Thomas has suggested using RAII instead of labels in awt, which is something that could be done outside of this change, but I'm still figuring out if doing so for the sites that this is a problem for in this change would be neater
=====
10-10-2023
A pull request was submitted for review.
URL: https://git.openjdk.org/jdk/pull/15096
Date: 2023-08-01 01:52:24 +0000