- It can be resolved by updating the IntelliJ configuration:
- File → Settings-> Build, Execution, Development → Compiler → Java Compiler
- update
Project bytecode version
to the relevant version , for this error it should be 10.
- also in
File -> project structure
and then take a look at Project and Modules tab. Set language level to 11 or whatever you’re using.