Skip to content

Commit d38e8ae

Browse files
committed
SI-7497 Fix scala.util.Properties.isMac
It returned wrong values because it used the java.vendor property instead of os.name. See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110.
1 parent b45e2b7 commit d38e8ae

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/library/scala/util/Properties.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private[scala] trait PropertiesTrait {
7272
* it is an RC, Beta, etc. or was built from source, or if the version
7373
* cannot be read.
7474
*/
75-
val releaseVersion =
75+
val releaseVersion =
7676
for {
7777
v <- scalaPropOrNone("maven.version.number")
7878
if !(v endsWith "-SNAPSHOT")
@@ -86,7 +86,7 @@ private[scala] trait PropertiesTrait {
8686
* @return Some(version) if this is a non-final version, None if this
8787
* is a final release or the version cannot be read.
8888
*/
89-
val developmentVersion =
89+
val developmentVersion =
9090
for {
9191
v <- scalaPropOrNone("maven.version.number")
9292
if v endsWith "-SNAPSHOT"
@@ -119,8 +119,7 @@ private[scala] trait PropertiesTrait {
119119
*/
120120
def lineSeparator = propOrElse("line.separator", "\n")
121121

122-
/** Various well-known properties.
123-
*/
122+
/* Various well-known properties. */
124123
def javaClassPath = propOrEmpty("java.class.path")
125124
def javaHome = propOrEmpty("java.home")
126125
def javaVendor = propOrEmpty("java.vendor")
@@ -136,10 +135,13 @@ private[scala] trait PropertiesTrait {
136135
def userHome = propOrEmpty("user.home")
137136
def userName = propOrEmpty("user.name")
138137

139-
/** Some derived values.
140-
*/
138+
/* Some derived values. */
139+
/** Returns `true` iff the underlying operating system is a version of Microsoft Windows. */
141140
def isWin = osName startsWith "Windows"
142-
def isMac = javaVendor startsWith "Apple"
141+
// See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for
142+
// the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110.
143+
/** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */
144+
def isMac = osName startsWith "Mac OS X"
143145

144146
// This is looking for javac, tools.jar, etc.
145147
// Tries JDK_HOME first, then the more common but likely jre JAVA_HOME,

0 commit comments

Comments
 (0)