I, like a lot of Java developers, use IntelliJ IDEA as my IDE and I really like it but I find there are a few things that I end up looking up over and over again so I decided to write them all down in one place and then perhaps I’ll remember them or at least I won’t have far to look.
Diamond operator is not supported in -source 1.5
For some reason when you start a new project IntelliJ always defaults to a source version of Java 5 even though at the time of writing Java 11 is out. Perhaps there’s a way to change this default but it takes just a moment to fix. Select File > Project Structure, under the Project Settings select Project and make sure Project Language Level (and the SDK) is set correctly and then under Project Settings again select Modules and make sure the Language Level is set correctly under sources. You might then get an error message “source release X requires target release 1.X”, this can usually be fixed by opening the Maven tab on the right and side and re-importing all modules (that will cause IntelliJ to respect the source and target settings).but