Check Java and JDK Configuration,
Go to File -> Project Structure -> Project and make sure that the correct JDK version is selected.
You can also check the JAVA_HOME environment variable and ensure it points to the correct JDK installation directory
Or try with Invalidate Caches/Restart, this will clear any internal corrupted caches.
This may or may not be helpful, Did you tried with restarting the system.