I\'m trying to use a java.lang.function.Function
in my java 8 code base, but i keep getting the following error in Intellij.
Usage of API
Maybe your config of repository has properties include compiler Version. examine
settings.xml
file.
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
I just fixed it as follows:
Right click the project -> Open Module Settings -> Modules -> Sources -> 8 or higher
And then
If still encounter the error and using maven, you have to add the build configuration in your pom.xml
:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>