In the idea settings, you need to check that the correct Java version is installed everywhere, for example 17:
- File - Settings - Build, Execution, Deployment - Compiler - Java Compiler:
- Project bytecode version : 17
- Per-module bytecode version : set "Target bytecode version" to 17 for each
- File - Project Structure - Modules : set "Language level" to 17 for each