Change Summary

Fix a method detectIfAnsiCapable in AnsiOutput using reflection invoking Console.isTerminal() which is newly added on JDK22.

As mentioned in #40160, starting JDK 22, System.console() never returns null. Instead, Console.isTerminal() is provided so we can use it to detect if the console is a terminal.

Since Spring Boot still has to built on Java 17, check for the existence of Console.isTerminal() is added and invokes only if it exists.

Related Issue

40160

Comment From: mhalbritter

Thank you very much and congratulations on your first contribution :tada:!

Comment From: wilkinsona

@mhalbritter did you try this suggestion rather than adding the new smoke test?

Comment From: mhalbritter

Oh sorry, I missed that. Let me investigate.

Comment From: mhalbritter

@wilkinsona Indeed that worked :)