diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-27 20:25:55 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-27 20:25:55 +0000 |
commit | 1c537ba1b3b68007e613a6c90d27cdae3f262c77 (patch) | |
tree | 9b80f6f3488cb9f50639f467dcf8fc88a9c2772c /src/compiler/scala/tools/nsc/io/AbstractFile.scala | |
parent | ba82b29b929f47ae345dbd32e5b6200bf68c231e (diff) | |
download | scala-1c537ba1b3b68007e613a6c90d27cdae3f262c77.tar.gz scala-1c537ba1b3b68007e613a6c90d27cdae3f262c77.tar.bz2 scala-1c537ba1b3b68007e613a6c90d27cdae3f262c77.zip |
Changing some code to not use collect on top of...
Changing some code to not use collect on top of a possibly changing
filesystem. Anonymous partial functions used with collect risk match
errors if guard results ever change, due to the guard being run twice
(isDefinedAt and then apply). No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/io/AbstractFile.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/io/AbstractFile.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala index e0eb61486f..77c7ad0147 100644 --- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala +++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala @@ -53,8 +53,10 @@ object AbstractFile { * @param file ... * @return ... */ - def getURL(url: URL): AbstractFile = - Option(url) collect { case url: URL if Path.isJarOrZip(url.getPath) => ZipArchive fromURL url } orNull + def getURL(url: URL): AbstractFile = { + if (url == null || !Path.isJarOrZip(url.getPath)) null + else ZipArchive fromURL url + } } /** |