I'm writing a game in Java using LibGDX, with only desktop
as the targeted platform. I just created a new LibGDX project, and imported some existing code into it, but now I'm getting a few errors. Specifically, using the diamond operator
. For example, this line of code:
HashMap<String, Integer> connectionsMap = new HashMap<>();
is generating this error:
Error:(20, 37) java: diamond operator is not supported in -source 1.6
(use -source 7 or higher to enable diamond operator)
Ideally, I'd like to use Java 8. The Gradle files in the module I imported were preserved, so I changed the sourceCompatibility
line in all the other build.gradle
files throughout the project from 1.6
to 1.8
, and I made sure that in the Project Structure > Project > Language Level
was set to Java 8. However, I'm still getting this issue. What else do I need to change for my project to use Java 8?