'Gradle Can't Resolve Java 9 `failedFuture` Even Though Using Java 11

I've been stuck on this for a couple of days now, any suggestions would be greatly appreciated.

I have a situation where I have a service using Java 11, however when I try to run a gradlew buld I get a compilation error:

error: cannot find symbol
        new ResponseFutureImpl<>(failedFuture(exception));
                                 ^

This is happening in a test file. However, when I run the test by itself it runs fine, and IntelliJ doesn't complain about not being able to find failedFuture.

Things I've tried:

  • Checking java compiler settings, gradle settings, and project / module settings in IntelliJ to confirm they are set to JDK 11.
  • Set sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 in my build.gradle file.
  • Checked gradle build scan to confirm it's using JDK 11
  • Confirmed JAVA_HOME is pointing to correct JDK
  • Invalidated IntelliJ caches
  • Ran gradle build with --refresh-dependencies and --rerun-tasks
  • Deleted ~/.gradle and reran gradlew build
  • Had someone with a fresh install of IntelliJ clone the project and try running on their machine, but they hit the same issue.

I'm plum out of ideas, and this seems like a very strange issue. Any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source