Skip to content

Commit

Permalink
restore compat for PathResolver, ClassPathFactory constructors
Browse files Browse the repository at this point in the history
restore source compat and bincompat

small followup to scala#7712. the community build found that a couple of
projects (mima, classpath-shrinker) were using the old
constructors. since it's easy to do, let's keep both source compat
(with the default arguments) and bincompat (with the extra
constructors, which we can toss for 2.13)
  • Loading branch information
SethTisue committed Mar 7, 2019
1 parent f0936e0 commit ca8c69d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/compiler/scala/tools/nsc/classpath/ClassPathFactory.scala
Expand Up @@ -22,7 +22,11 @@ import scala.tools.nsc.util.ClassPath
* Provides factory methods for 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 ClassPathFactory(settings: Settings, closeableRegistry: CloseableRegistry) {
class ClassPathFactory(settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry) {

@deprecated("for bincompat in 2.12.x series", "2.12.9") // TODO remove from 2.13.x
def this(settings: Settings) = this(settings, new CloseableRegistry)

/**
* Create a new classpath based on the abstract file.
*/
Expand Down Expand Up @@ -78,7 +82,10 @@ class ClassPathFactory(settings: Settings, closeableRegistry: CloseableRegistry)
}

object ClassPathFactory {
def newClassPath(file: AbstractFile, settings: Settings, closeableRegistry: CloseableRegistry): ClassPath = file match {
@deprecated("for bincompat in 2.12.x series", "2.12.9") // TODO remove from 2.13.x
def newClassPath(file: AbstractFile, settings: Settings): ClassPath =
newClassPath(file, settings, new CloseableRegistry)
def newClassPath(file: AbstractFile, settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry): ClassPath = file match {
case vd: VirtualDirectory => VirtualDirectoryClassPath(vd)
case _ =>
if (file.isJarOrZip)
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/scala/tools/util/PathResolver.scala
Expand Up @@ -206,7 +206,11 @@ object PathResolver {
}
}

final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistry) {
final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry) {

@deprecated("for bincompat in 2.12.x series", "2.12.9") // TODO remove from 2.13.x
def this(settings: Settings) = this(settings, new CloseableRegistry)

private val classPathFactory = new ClassPathFactory(settings, closeableRegistry)

import PathResolver.{ AsLines, Defaults, ppcp }
Expand Down

0 comments on commit ca8c69d

Please sign in to comment.