JDK compatibility
Closed this issue · 5 comments
Travis using JDK 11 recently failed:
https://travis-ci.org/gaul/modernizer-maven-plugin/builds/544727117
this is due to Travis upgrading from JDK 8:
https://travis-ci.org/gaul/modernizer-maven-plugin/builds/544212234
Newer JDKs remove sun.misc.BASE64Decoder
and sun.misc.BASE64Encoder
which the unit tests reference. Modernizer only requires JDK 7 but this will become an issue for developers at some point. Perhaps remove the problematic APIs from the unit tests?
The build path can be easily split between java 7 and java 8 needs. So the unit tests can then take advantage of java 8.
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.testSource>1.8</maven.compiler.testSource>
<maven.compiler.testTarget>1.8</maven.compiler.testTarget>
This issue tracks JDK 11 not being able to run the modernizer test suite due to one of the functions being removed. How does your comment address this?
@gaul The issue is that sun.* shouldn't have been used. Jdk 8 introduced direct support for base64 decoder/encoder. Thus the only change that needs to apply here is using jdk 8 only to build which is likely already the case. It doesn't really matter that jdk 11 simply deleted those classes. The changes are very minor and rather simple. Using the options I provided above, jdk 8 through 11 will properly build without failing. I can write a PR to resolve this.
After reviewing the code I understand the point now. My PR #106 simply shows switching it which obviously serves no purpose as to a real solution other than maybe to indicate a need for usage of toolchains to run that specific test in earlier jdk or some other way to harness the results there.