Select the project, then File > ProjectStructure > ProjectSettings > Modules -> sources
You probably have the Language Level set at 9:
Just change it to 8 (or whatever you need) and you’re set to go.
Also, check the same Language Level settings mentioned above, under Project Settings > Project