mpdunson
mpdunson

Reputation: 237

Getting "method references are not supported in -source 1.7" in intellij, but my project setting have Java 1.8

Hi I'm trying to run a simple Java program that uses method references, but IntelliJ keeps saying:

method references are not supported in -source 1.7 (use -source 8 or higher to enable method references): 31

However, when I open my project settings the ProjectSDK is set to 1.8 and the Project language level is set to 8

When I click on Modules the Language level is set to 8

and if I look under Preferences > Build, Execution, Deployment > Build Tools > Gradle

and look at the Gradle JVM it says it is the same as the Project SDK which is 1.8.

Also if I look under Preferences > Build, Execution, Deployment > Compiler > Java Compiler

like suggest here I get 8 which is correct.

So why is it giving me that error message? I don't believe there is anything 1.7 in my project.

Upvotes: 2

Views: 1417

Answers (1)

SaschaA1982
SaschaA1982

Reputation: 81

what about your "sourceCompatibility" and "targetCompatibility" in your gradle-file?

can you try to put these properties to:

def javaVersion = JavaVersion.VERSION_1_8;
sourceCompatibility=javaVersion;
targetCompatibility=javaVersion;

Upvotes: 1

Related Questions