[JAVA-2694] Configure IntelliJ to build with Java 9 Created: 08/Dec/17  Updated: 28/Oct/23  Resolved: 01/May/18

Status: Closed
Project: Java Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Java9

 Description   

There is an apparent change of behavior in Intellij 2017.3 when the project is configured to use Java 9. When the source/target compatibility is set to 1.6, IntelliJ's compilation task seems to exclude any classes that were added after JDK 1.6, resulting in a failure to find classes that the driver relies on when running on later Java versions, e.g. java.nio.channels.AsynchronousSocketChannel and java.time.Instant.

In the source view, IntelliJ shows no errors and correctly navigates to the location of those classes in their respective Java 9 modules.

The only workaround I've found is to manually update the language level in the Project Structure dialog after syncing the Gradle build files.



 Comments   
Comment by Jeffrey Yemin [ 01/May/18 ]

This can be resolved by unchecking the "Use '-release' option for cross-compilation (Java 9 and later)" on the "Build, Execution, Deployment > Compiler > Java Compiler" preference page. Otherwise when it builds it sets the "release" command line argument for javac to "-release 6" based on the "targetCompatibility = JavaVersion.VERSION_1_6" in build.gradle.

Generated at Thu Feb 08 08:57:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.