diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-23 22:57:15 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-23 22:57:15 +0000 |
commit | 0e74720c491ce13e5e904e0bc39e9a60af26f37c (patch) | |
tree | 739584c007c30a6b1974a42674bb1e9b5aa4c721 /src/compiler/scala/tools/util/PathResolver.scala | |
parent | 3a1463cd833175bdaa7a31d96a41a0d926b0e9db (diff) | |
download | scala-0e74720c491ce13e5e904e0bc39e9a60af26f37c.tar.gz scala-0e74720c491ce13e5e904e0bc39e9a60af26f37c.tar.bz2 scala-0e74720c491ce13e5e904e0bc39e9a60af26f37c.zip |
Some 11th hour modifications with the dual purp...
Some 11th hour modifications with the dual purpose of a smooth console
life for sbt and so the repl can be used on google app engine. Although
this patch may look largish to be entering at RC4, there isn't a lot
going on. It's trying to make these dangerous things:
- property and environment variable accesses
- thread creation
- signal handler installation
happpen in a sufficiently uniform way that people who don't want them
and places who don't allow them are not left with an unfixable situation
where things blow up inside private methods. Also, the (ahem) lower than
usual elegance levels are due to it being intended for 2.9.x as well.
Review by harrah.
Diffstat (limited to 'src/compiler/scala/tools/util/PathResolver.scala')
-rw-r--r-- | src/compiler/scala/tools/util/PathResolver.scala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 3ea5aa1703..c5d0e1edea 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -7,7 +7,7 @@ package scala.tools package util import java.net.{ URL, MalformedURLException } -import scala.util.Properties._ +import scala.tools.reflect.WrappedProperties.AccessControl import nsc.{ Settings, GenericRunnerSettings } import nsc.util.{ ClassPath, JavaClassPath, ScalaClassLoader } import nsc.io.{ File, Directory, Path, AbstractFile } @@ -18,6 +18,10 @@ import PartialFunction.condOpt // https://wiki.scala-lang.org/display/SW/Classpath object PathResolver { + // Imports property/environment functions which suppress + // security exceptions. + import AccessControl._ + def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse "" /** Map all classpath elements to absolute paths and reconstruct the classpath. @@ -34,10 +38,9 @@ object PathResolver { /** Values found solely by inspecting environment or property variables. */ object Environment { - private def searchForBootClasspath = { - import scala.collection.JavaConversions._ - System.getProperties find (_._1 endsWith ".boot.class.path") map (_._2) getOrElse "" - } + private def searchForBootClasspath = ( + systemProperties find (_._1 endsWith ".boot.class.path") map (_._2) getOrElse "" + ) /** Environment variables which java pays attention to so it * seems we do as well. |