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.
1 parent 5de064e commit db22f49Copy full SHA for db22f49
library/src/scala/util/Properties.scala
@@ -164,9 +164,10 @@ private[scala] trait PropertiesTrait {
164
165
/** System.console.isTerminal, or just check for null console on JDK < 22 */
166
private[scala] lazy val consoleIsTerminal: Boolean = {
167
+ import language.reflectiveCalls
168
val console = System.console
169
def isTerminal: Boolean =
- try classOf[java.io.Console].getMethod("isTerminal", null).invoke(console).asInstanceOf[Boolean]
170
+ try console.asInstanceOf[{ def isTerminal(): Boolean }].isTerminal()
171
catch { case _: NoSuchMethodException => false }
172
console != null && (!isJavaAtLeast("22") || isTerminal)
173
}
0 commit comments