IBM / cloudant-java-sdk

Cloudant SDK for Java
Apache License 2.0
22 stars 17 forks source link

Update test Java versions #114

Closed ricellis closed 2 years ago

ricellis commented 3 years ago

Is your feature request related to a problem? Please describe.

Java lifecycle updates.

Describe the solution you'd like

We should stop testing 14 which was EOL in Sept and start testing 16 in preparation for the availability of LTS 17 in Sept.

We should also update the prereq statement to be Java 8 or 11 as those are the LTS versions.

Describe alternatives you've considered

Additional context

ricellis commented 2 years ago

17 is available as the LTS now, so now this work should change to result in: Supported versions: 8, 11 (17 when the core supports it) Travis test versions: 8, 11, (17 if we can resolve powermock issues)

ricellis commented 2 years ago

As mentioned in the orignal PR related to this ticket it is possible to workaround the PowerMock issue by using --illegal-access=warn (the default in Java 9-15) since in Java 16 the default changed to --illegal-access=deny. The --illegal-access switch has been removed entirely in Java 17 so that workaround of switching deny back to warn is no longer possible. The workaround is to instruct the JVM to export (and open) the necessary packages from the java.base module to the unnamed test modules e.g.

<surefire.options>--add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</surefire.options>

Using that workaround instead should allow the tests to pass using any Java 9+ without needing to globally allow illegal access while we wait for https://github.com/powermock/powermock/issues/1094

For more info on this see JEP 261 breaking encapsulation.

vmatyus commented 2 years ago

Tried out, this JVM setting indeed worked. So I've updated the content of the PR.

vmatyus commented 2 years ago

Turned out 14 is not LTS version and version 17 needs further testing to be fully trustworthy supported version. Related documentation change: https://github.com/IBM/cloudant-java-sdk/pull/198