change the Java version in each of these places:
File - Project structure - Project - Project SDK - 21.
File -Project structure - Project - Project language level -21.
File -Project structure -Project -Modules - Sources -- 21 or
Just go to "Project Settings-Build, Execution...compiler-java compiler" and then change your bytecode version to your current java version.