We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6845f54 + 47295a9 commit a4be3e8Copy full SHA for a4be3e8
library/src/scala/util/Properties.scala
@@ -148,9 +148,10 @@ private[scala] trait PropertiesTrait {
148
149
/** System.console.isTerminal, or just check for null console on JDK < 22 */
150
private[scala] lazy val consoleIsTerminal: Boolean = {
151
+ import language.reflectiveCalls
152
val console = System.console
153
def isTerminal: Boolean =
- try classOf[java.io.Console].getMethod("isTerminal", null).invoke(console).asInstanceOf[Boolean]
154
+ try console.asInstanceOf[{ def isTerminal(): Boolean }].isTerminal()
155
catch { case _: NoSuchMethodException => false }
156
console != null && (!isJavaAtLeast("22") || isTerminal)
157
}
0 commit comments