<AWT Dev> [PATCH] Fix some C++ conformance issues in AWT Windows code

Andrew Luo andrewluotechnologies at outlook.com
Tue May 28 20:52:33 UTC 2019

Adding an updated patch.  It seems I missed a file.

Testing done: compiled with both /permissive- set and without.



From: awt-dev <awt-dev-bounces at openjdk.java.net> On Behalf Of Andrew Luo
Sent: Monday, May 13, 2019 5:40 PM
To: awt-dev at openjdk.java.net
Subject: <AWT Dev> [PATCH] Fix some C++ conformance issues in AWT Windows code

I've been trying to get the JDK to compile with the new /permissive- switch in VS2017 (https://devblogs.microsoft.com/cppblog/permissive-switch/) however there have been a few issues in various parts of the code.

While testing this, I found some issues in the AWT code.  In one case we name a function with the class:: prefix when the function is declared inline in the class definition.  Other cases include where we are assigning string literals to non-const char* variables.  I took some time to fix these and attached a patch.  Let me know if there are any comments.

c:\Users\Andrew\Documents\mercurial\openjdk\jdk\src\java.desktop\windows\native\libawt\windows\awt.h(343): error C2440: 'return': cannot convert from 'const unsigned short *' to 'LPWSTR'
c:\Users\Andrew\Documents\mercurial\openjdk\jdk\src\java.desktop\windows\native\libawt\windows\awt.h(343): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)
c:\users\andrew\documents\mercurial\openjdk\jdk\src\java.desktop\windows\native\libawt\windows\awt_Component.h(455): error C2061: syntax error: identifier 'javaKey'
c:\users\andrew\documents\mercurial\openjdk\jdk\src\java.desktop\windows\native\libawt\windows\awt_Component.h(455): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20190528/4ec1aa87/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jdkcomformanceawt.txt
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20190528/4ec1aa87/jdkcomformanceawt.txt>

More information about the awt-dev mailing list