Closed Michael-A-McMahon closed 11 months ago
The limitation of this release option is that we must compile with a JDK version newer than 8.
We see this first CI run failing due to using JDK 8. I'll see if I can update that.
Lifting the limitation I mentioned in my last comment, I've added a profile which actives only if the JDK is 9 or newer. This profile will set the release option if the JDK supports it. Otherwise, we are just compiling with JDK 8 so there's no need to set it.
The profile is similar to the one suggested here: https://issues.apache.org/jira/browse/MCOMPILER-339
This branch sets the maven.compiler.release setting to 8. This avoids sneaky runtime failures that can happen when a new JDK version is compiling our code. For instance, calls to CharBuffer.clear() break if compiled by a JDK newer than 8, and then run on JDK 8. This is because the return type of the clear() method changed after JDK 8, and our users will hit:
Setting the release option ensures that byte code is consistent with the API of the specified JDK 8. With this CharBuffer example, it ensures that byte code calls a method with a
Buffer
return type, rather thanCharBuffer
. The release option is documented here: https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html