Skip to content

Commit aab037f

Browse files
committed
Memoize osName properties and use assumeFalse, noWin
1 parent d4e7f58 commit aab037f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/src/scala/util/Properties.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ private[scala] trait PropertiesTrait {
130130

131131
/* Some derived values. */
132132
/** Returns `true` iff the underlying operating system is a version of Microsoft Windows. */
133-
def isWin = osName startsWith "Windows"
133+
lazy val isWin = osName.startsWith("Windows")
134134
// See https://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for
135135
// the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110.
136136
/** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */
137-
def isMac = osName startsWith "Mac OS X"
137+
lazy val isMac = osName.startsWith("Mac OS X")
138138
/** Returns `true` iff the underlying operating system is a Linux distribution. */
139-
def isLinux = osName startsWith "Linux"
139+
lazy val isLinux = osName.startsWith("Linux")
140140

141141
/* Some runtime values. */
142-
private[scala] def isAvian = javaVmName contains "Avian"
142+
private[scala] lazy val isAvian = javaVmName.contains("Avian")
143143

144144
private[scala] def coloredOutputEnabled: Boolean = propOrElse("scala.color", "auto") match {
145145
case "auto" => System.console() != null && !isWin

0 commit comments

Comments
 (0)