diff options
author | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2013-09-27 15:33:19 +0200 |
---|---|---|
committer | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2013-09-27 15:33:19 +0200 |
commit | 59ba77519476b9ac7f420a6e23ddb8dd5b3d5608 (patch) | |
tree | 0a46bb3d2c48275910ec9e063d1807473222fe17 | |
parent | a3f71badf67bbaac1a4ba16f68211ea6e31aa473 (diff) | |
download | scala-59ba77519476b9ac7f420a6e23ddb8dd5b3d5608.tar.gz scala-59ba77519476b9ac7f420a6e23ddb8dd5b3d5608.tar.bz2 scala-59ba77519476b9ac7f420a6e23ddb8dd5b3d5608.zip |
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).
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/util/PathResolver.scala | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 96c93a838b..2d945a7aa4 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -181,6 +181,7 @@ trait ScalaSettings extends AbsScalaSettings val Yinvalidate = StringSetting ("-Yinvalidate", "classpath-entry", "Invalidate classpath entry before run", "") val YvirtClasses = false // too embryonic to even expose as a -Y //BooleanSetting ("-Yvirtual-classes", "Support virtual classes") val YdisableUnreachablePrevention = BooleanSetting("-Ydisable-unreachable-prevention", "Disable the prevention of unreachable blocks in code generation.") + val YnoLoadImplClass = BooleanSetting ("-Yno-load-impl-class", "Do not load $class.class files.") val exposeEmptyPackage = BooleanSetting("-Yexpose-empty-package", "Internal only: expose the empty package.").internalOnly() 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 { |