Summary
javac creates long long literals that end in the microsoft specific i64 suffix when on Windows, which is outdated and recommended not to be used by Microsoft themselves. Additionally this also breaks other Windows compilers which are not the Microsoft Visual C++ compiler, so this should be fixed.
Problem
Older (In fact, absolutely ancient) versions of the Microsoft Visual C++ compiler used to have i64 as a suffix for 64 bit long literals. C and C++ have the long long type instead (Which is the type that exactly matches i64 on Microsoft's compiler) as the LL suffix, which is the standard way of specifying 64 bit longs. Hardlocking javac to generating headers which always use i64 for long long on Windows completely breaks other conforming compilers on Windows which Java developers may be using, as well as slow progress on making the JDK able to be compiled by different compilers on the same OS (see JDK-8288293)
Solution
An easy solution is to remove the workaround within the javac header creator JNIWriter.java, which checks if the current operating system is Windows before deciding to use the corresponding long long literal suffix. Since the i64 suffix is extremely old and virtually every Microsoft Visual C++ compiler past 2008 accepts LL as well, and since Microsoft themselves recommend using LL over i64, this should be of minimal compatibility risk.
Specification
https://github.com/openjdk/jdk/pull/13457/files
@@ -271,8 +271,7 @@ static void printStaticDefines(PrintWriter out, Pair<ClassSymbol, VarSymbol> p)
valueStr = value.toString() + "L";
break;
case LONG:
- // Visual C++ supports the i64 suffix, not LL.
- valueStr = value.toString() + ((isWindows) ? "i64" : "LL");
+ valueStr = value.toString() + "LL";
- csr of
-
JDK-8305955 Remove Visual C++ specific workaround in javac
-
- In Progress
-