From 30d6fce50aba1d73173339b0add4808bc13b1c40 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 25 Apr 2016 21:26:17 +0200 Subject: Remove abstraction layer in classpath implementation --- .../tools/nsc/classpath/FlatClassPathFactory.scala | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/compiler/scala/tools/nsc/classpath/FlatClassPathFactory.scala (limited to 'src/compiler/scala/tools/nsc/classpath/FlatClassPathFactory.scala') diff --git a/src/compiler/scala/tools/nsc/classpath/FlatClassPathFactory.scala b/src/compiler/scala/tools/nsc/classpath/FlatClassPathFactory.scala deleted file mode 100644 index 463301696e..0000000000 --- a/src/compiler/scala/tools/nsc/classpath/FlatClassPathFactory.scala +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2014 Contributor. All rights reserved. - */ -package scala.tools.nsc.classpath - -import scala.reflect.io.VirtualDirectory -import scala.tools.nsc.Settings -import scala.tools.nsc.io.AbstractFile -import FileUtils.AbstractFileOps - -/** - * Provides factory methods for flat classpath. When creating classpath instances for a given path, - * it uses proper type of classpath depending on a types of particular files containing sources or classes. - */ -class FlatClassPathFactory(settings: Settings) extends ClassPathFactory[FlatClassPath] { - def newClassPath(file: AbstractFile): FlatClassPath = FlatClassPathFactory.newClassPath(file, settings) - - def sourcesInPath(path: String): List[FlatClassPath] = - for { - file <- expandPath(path, expandStar = false) - dir <- Option(AbstractFile getDirectory file) - } yield createSourcePath(dir) - - private def createSourcePath(file: AbstractFile): FlatClassPath = - if (file.isJarOrZip) - ZipAndJarFlatSourcePathFactory.create(file, settings) - else if (file.isDirectory) - new DirectoryFlatSourcePath(file.file) - else - sys.error(s"Unsupported sourcepath element: $file") -} - -object FlatClassPathFactory { - def newClassPath(file: AbstractFile, settings: Settings): FlatClassPath = file match { - case vd: VirtualDirectory => VirtualDirectoryFlatClassPath(vd) - case _ => - if (file.isJarOrZip) - ZipAndJarFlatClassPathFactory.create(file, settings) - else if (file.isDirectory) - new DirectoryFlatClassPath(file.file) - else - sys.error(s"Unsupported classpath element: $file") - } -} -- cgit v1.2.3