Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"java.lang.invoke.StringConcatFactory cannot be resolved." recurring error in VS Code

I'm currently making a project and this error pops up on the first line of VS Code whenever I use lines such as this:

return "UserProfile{" +
                "userName='" + playerName + '\'' +
                ", numKalahGamesPlayed=" + kalahPlayed +
                ", numAyoGamesPlayed=" + ayoPlayed +
                ", numKalahGamesWon=" + kalahGamesWon +
                ", numAyoGamesWon=" + ayoGamesWon +
                '}';

This error always pops up and doesn't go away until I use something other than the '+' key in System.out.println messages.

This error just appears and doesn't affect the functionality of the code and doesn't stop me from doing "gradle build" but is annoying to look at.

My program is in Java and I've already refreshed/restarted VS Code and I've clean the Java lang workspace multiple times but nothing works. I know that StringBuilder works and I know how to use it but it's much easier to use System.out.println();

Can anyone help me fix this problem?

like image 353
DrunkMicrowave Avatar asked Jun 18 '26 08:06

DrunkMicrowave


1 Answers

Set compiler compliance level to Java 1.8.

like image 82
kayz1 Avatar answered Jun 19 '26 23:06

kayz1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!