Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pulguptaAdobe opened this issue Jan 15, 2024 · 0 comments
Closed

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

pulguptaAdobe opened this issue Jan 15, 2024 · 0 comments

Comments

@pulguptaAdobe
Copy link
Contributor

pulguptaAdobe commented Jan 15, 2024

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

@pulguptaAdobe pulguptaAdobe changed the title SDK is not getting build using Java 8 SDK build failing with Java 8 Jan 15, 2024
@pulguptaAdobe pulguptaAdobe changed the title SDK build failing with Java 8 SDK should not use any Java 11 features Jan 15, 2024
pulguptaAdobe added a commit to pulguptaAdobe/aio-lib-java that referenced this issue Jan 15, 2024
@francoisledroff francoisledroff changed the title SDK should not use any Java 11 features aio-lib-java build: enforce SDK java-8 language rules Jan 16, 2024
@francoisledroff francoisledroff changed the title aio-lib-java build: enforce SDK java-8 language rules aio-lib-java build: enforce SDK java 8 language rules Jan 16, 2024
francoisledroff pushed a commit that referenced this issue Jan 16, 2024
@francoisledroff francoisledroff changed the title aio-lib-java build: enforce SDK java 8 language rules aio-lib-java build: enforce Java 8 language rules Jan 16, 2024
francoisledroff added a commit that referenced this issue Jan 16, 2024
… 8 and avoid accidental Java 11 api use (#206)

Co-authored-by: Pulkit Gupta <92841386+pulguptaAdobe@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants