For me going to File -> Project Structure -> Project -> SDK -> Add SDK -> Download JDK and selecting Oracle OpenJDK solved the problem. Prior to that I had a different JDK selected and apparently it didn't include source code
This is the only thing that worked for me. I had a 1.8 SDK selected and tried a couple of different 1.8 SDKs (Temurin, Corretto). I also tried manually adding the source as suggested by others.
In the end using Oracle openjdk-23 sorted it. I still have my language level set to 8 as that's what I need but I erroneously thought the SDK needed to be 8(1.8) as well.