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
Adapt new behavior of System.console() since JDK22 #69
base: master
Are you sure you want to change the base?
Conversation
// Console.isTerminal() was introduced in Java 22 | ||
private static boolean isTerminal(Console console) { | ||
try { | ||
Method isTerminal = Console.class.getMethod("isTerminal"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's worth switching to a multi-versioned jar instead of relying on reflection + exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @stalep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, instead of reflection could we check if Runtime.version() > 21
?
Tbh, I'm not sure what's the "best" solution here, I'm open for anything. This method is usually not called more than once anyway...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the new method isTerminal won't compile on older JDKs (<= 21).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves #68