From 59ba77519476b9ac7f420a6e23ddb8dd5b3d5608 Mon Sep 17 00:00:00 2001 From: Sébastien Doeraene Date: Fri, 27 Sep 2013 15:33:19 +0200 Subject: Add -Yno-load-impl-class disabling loading of $class.class files. The parent commit, a3f71badf67bbaac1a4ba16f68211ea6e31aa473, removed some logic preventing $class.class files to be loaded. It did so only when the inliner was off. Should this cause any issue, this option provides a means to restore the old behavior by *never* loading $class.class files. So, using -inline -Yno-load-impl-class will not load $class.class files either (where previously -inline would load them). The two old behaviors being available by *either* using -inline *or* -Yno-load-impl-class (not both). --- src/compiler/scala/tools/util/PathResolver.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/util') diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 6022344208..5526660509 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -11,6 +11,7 @@ import scala.tools.reflect.WrappedProperties.AccessControl import scala.tools.nsc.{ Settings } import scala.tools.nsc.util.{ ClassPath, JavaClassPath } import scala.reflect.io.{ File, Directory, Path, AbstractFile } +import scala.reflect.runtime.ReflectionUtils import ClassPath.{ JavaContext, DefaultJavaContext, join, split } import PartialFunction.condOpt import scala.language.postfixOps @@ -163,6 +164,12 @@ object PathResolver { |}""".asLines } + // used in PathResolver constructor + private object NoImplClassJavaContext extends JavaContext { + override def isValidName(name: String): Boolean = + !ReflectionUtils.scalacShouldntLoadClassfile(name) + } + // called from scalap def fromPathString(path: String, context: JavaContext = DefaultJavaContext): JavaClassPath = { val s = new Settings() @@ -193,7 +200,9 @@ object PathResolver { class PathResolver(settings: Settings, context: JavaContext) { import PathResolver.{ Defaults, Environment, AsLines, MkLines, ppcp } - def this(settings: Settings) = this(settings, DefaultJavaContext) + def this(settings: Settings) = this(settings, + if (settings.YnoLoadImplClass) PathResolver.NoImplClassJavaContext + else DefaultJavaContext) private def cmdLineOrElse(name: String, alt: String) = { (commandLineFor(name) match { -- cgit v1.2.3