diff options
author | Janek Bogucki <janekdb@gmail.com> | 2015-11-26 22:27:19 +0000 |
---|---|---|
committer | Janek Bogucki <janekdb@gmail.com> | 2015-11-26 22:27:19 +0000 |
commit | 9d6cdf0066716da71b3d668628a25859b353ee5e (patch) | |
tree | c5d6ca766a609ad60b5e08da5e680746d07b53d0 /src/repl | |
parent | 2890f0b767948dd9a0953b1e669e85dbd45ec0a7 (diff) | |
download | scala-9d6cdf0066716da71b3d668628a25859b353ee5e.tar.gz scala-9d6cdf0066716da71b3d668628a25859b353ee5e.tar.bz2 scala-9d6cdf0066716da71b3d668628a25859b353ee5e.zip |
Apply some static code analysis recommendations
Fix a batch of code inspection recommendations generated by IntelliJ 14.1.5.
Categories of fix,
Unnecessary public modifier in interface
Replace filter+size with count
Replace filter+nonEmpty with exists
Replace filter+headOption with find
Replace `if (x != null) Some(x) else None` with Option(x)
Replace getOrElse null with orNull
Drop redundant semicolons
Replace anon fun with PF
Replace anon fun with method
Diffstat (limited to 'src/repl')
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala | 2 | ||||
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/JavapClass.scala | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala index e9b0234a4f..c2ccfc8064 100644 --- a/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala +++ b/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala @@ -175,7 +175,7 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput case Some((clazz, runtimeType)) => val sym = intp.symbolOfTerm(id) if (sym.isStable) { - val param = new NamedParam.Untyped(id, intp valueOfTerm id getOrElse null) + val param = new NamedParam.Untyped(id, intp valueOfTerm id orNull) Some(TypeMemberCompletion(tpe, runtimeType, param)) } else default diff --git a/src/repl/scala/tools/nsc/interpreter/JavapClass.scala b/src/repl/scala/tools/nsc/interpreter/JavapClass.scala index c240ab027a..9ad9479d05 100644 --- a/src/repl/scala/tools/nsc/interpreter/JavapClass.scala +++ b/src/repl/scala/tools/nsc/interpreter/JavapClass.scala @@ -600,11 +600,11 @@ object JavapClass { def parents: List[ClassLoader] = parentsOf(loader) /* all file locations */ def locations = { - def alldirs = parents flatMap (_ match { + def alldirs = parents flatMap { case ucl: ScalaClassLoader.URLClassLoader => ucl.classPathURLs case jcl: java.net.URLClassLoader => jcl.getURLs case _ => Nil - }) + } val dirs = for (d <- alldirs; if d.getProtocol == "file") yield Path(new JFile(d.toURI)) dirs } |