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

Andrew Luo andrewluotechnologies at outlook.com
Tue May 14 00:39:55 UTC 2019


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

Thanks,

-Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20190514/5fafe1cb/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/20190514/5fafe1cb/jdkcomformanceawt.txt>


More information about the awt-dev mailing list