1

Note: this is not a duplicate. This version of spark requires either jdk 1.7 or 1.8. The parent pom.xml entry is shown here:

   <java.version>1.7</java.version>

As shown in the screenshot we have java 1.8 for the SDK and the language level:

enter image description here

And here are the modules settings:

enter image description here

But Intellij is just confused about that:

Error:(73, 51) java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)

This is a spark project being built from maven on OS/X. Intellij Ultimate 14.1.4

enter image description here

Update Here is the pom.xml entry for the jdk

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560

1 Answers1

0

If you are using Maven, please watch your pom.xml file. Even if your IntelliJ Project is set to Java 8 your project will compile with the version of Java set in your pom.xml.

Add this to your pom.xml

<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Or directly in the maven plugin :

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <source>1.8</source> <!-- java version here -->
                <target>1.8</target> <!-- java version here -->
            </configuration>
 </plugin>
Guillaume M
  • 470
  • 1
  • 5
  • 12