I' trying to build a in IntelliJ IDEA project that is not mine and I got the following error:
java: diamond operator is not supported in -source 1.6 (use -source 7 or higher to enable diamond operator)
How do I change this setting in IntelliJ IDEA?
I know the OP uses IntelliJ IDEA, but Android Studio is based on IntelliJ IDEA, so I wanna say one more word.
If you use Android Studio,
command+;
(for Mac) orFile->Project Structure
, then in the open window follow the settings:For me, changing the Language Level in Project Structure and restarting IDEA didn't help.
I had to edit the
build.gradle
incore
module and change the source compatibility from 1.6 to 1.7:Build -> Clean Project
File->Project structure->Project Settings->Modules->Language level
Change level using drop down.
Otherwise, If you are using maven for build,
And, if you're working with a maven project, for sanity, remember to set the java version in the pom too.
Ctrl+Alt+Shift+S (Project Structure icon)
Then change Project language level
File -> Project Structure -> Sources -> Language level
You will have to reload IDEA