adobe / aio-lib-java

Adobe I/O - Java SDK
https://opensource.adobe.com/aio-lib-java/
Apache License 2.0
5 stars 17 forks source link

`aio-lib-java` build: enforce Java `8` language rules #204

Closed pulguptaAdobe closed 6 months ago

pulguptaAdobe commented 6 months ago

Expected Behaviour

SDK should not use any Java 11 API to maintain compatibility with Java 8 (why Java 8 ? see GH-104) The sdk (its generated classes as well its the public API) should be compiled following the rules of the programming language of the specified 8 release. The build should detect and generate an error when using APIs that don't exist in previous releases of Java SE.

Actual Behaviour

Earlier we were using JDK 8 to build sdk but with recent changes and introduction of mockito-core-5.4.0.jar, SDK build is now not compatible with JDK 8. Simply downgrading the mockito-core version will not solve the issue as many tests are dependent on the same. For this we are now using JDK 11 but this can result in usage of Java 11 API in code which can go unnoticed as the code will compile correctly but will fail at runtime while using the SDK with Java 8.

Reproduce Scenario (including but not limited to)

Add line List<String> myList = List.of("some", "new", "java", "code"); Do mvn clean package Compilation will work correctly Ideally compilation should fail as we are using Java 11 API List.of which will not work on Java 8

Platform and Version

Java 8

Sample Code that illustrates the problem

List<String> myList = List.of("some", "new", "java", "code");

Logs taken while reproducing problem