Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnsiOutput.detectIfAnsiCapable broken on JDK22 #40172

Closed

Conversation

facewise
Copy link
Contributor

@facewise facewise commented Apr 5, 2024

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 5, 2024
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 18, 2024
@philwebb philwebb added this to the 3.1.x milestone Apr 18, 2024
@philwebb philwebb self-assigned this Apr 18, 2024
@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.2.x Apr 22, 2024
@facewise facewise force-pushed the fix-broken-ansi-detection-jdk22 branch from b0fe851 to e56a0f3 Compare April 24, 2024 05:12
@facewise facewise force-pushed the fix-broken-ansi-detection-jdk22 branch from e56a0f3 to f365476 Compare April 24, 2024 05:15
@scottfrederick scottfrederick changed the title Fix broken AnsiOutput.detectIfAnsiCapable on JDK22 AnsiOutput.detectIfAnsiCapable broken on JDK22 Apr 24, 2024
@philwebb philwebb removed their assignment May 2, 2024
@mhalbritter mhalbritter self-assigned this May 2, 2024
@mhalbritter
Copy link
Contributor

Thank you very much and congratulations on your first contribution 🎉!

@mhalbritter mhalbritter modified the milestones: 3.2.x, 3.2.6 May 2, 2024
@wilkinsona
Copy link
Member

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

@mhalbritter
Copy link
Contributor

Oh sorry, I missed that. Let me investigate.

@mhalbritter
Copy link
Contributor

@wilkinsona Indeed that worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants