Removing printlns and adding the test, DOH.

This commit is contained in:
Josh Suereth 2014-09-09 09:16:10 -04:00
parent d2950da9dd
commit da1fc33b52
4 changed files with 52 additions and 6 deletions

View File

@ -0,0 +1,29 @@
lazy val OtherScala = config("other-scala").hide
configs(OtherScala)
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.11.1" % OtherScala.name
managedClasspath in OtherScala := Classpaths.managedJars(OtherScala, classpathTypes.value, update.value)
// Hack in the scala instance
scalaInstance := {
val rawJars = (managedClasspath in OtherScala).value.map(_.data)
val scalaHome = (target.value / "scala-home")
def removeVersion(name: String): String =
name.replaceAll("\\-2.11.1", "")
for(jar <- rawJars) {
val tjar = scalaHome / s"lib/${removeVersion(jar.getName)}"
IO.copyFile(jar, tjar)
}
IO.listFiles(scalaHome).foreach(f => System.err.println(s" * $f}"))
ScalaInstance(scalaHome, appConfiguration.value.provider.scalaProvider.launcher)
}
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.3" % "test"
scalaVersion := "2.11.0"

View File

@ -0,0 +1,21 @@
package akka.actor
import org.junit._
class BadTest {
@Test
def testCpIssue(): Unit = {
// TODO - This is merely the laziest way to run the test. What we want to do:
// * Load something from our own classloader that's INSIDE the scala library
// * Try to load that same something from the THREAD CONTEXT classloader.
// * Ensure we can do both, i.e. the second used to be filtered and broken.
val current = Thread.currentThread.getContextClassLoader
val mine = this.getClass.getClassLoader
val system = ActorSystem()
def evilGetThreadExectionContextName =
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName
val expected = "scala.concurrent.Future$InternalCallbackExecutor$"
Assert.assertEquals("Failed to grab appropriate Akka name", expected, evilGetThreadExectionContextName)
}
}

View File

@ -0,0 +1 @@
> test

View File

@ -59,13 +59,8 @@ final class ClasspathFilter(parent: ClassLoader, root: ClassLoader, classpath: S
val c = super.loadClass(className, resolve)
if (includeLoader(c.getClassLoader, root) || fromClasspath(c))
c
else {
System.err.println(s"DEBUGME: Failing to load class $className because it was not in expected parent chain.")
System.err.println(s"DEBUGME: Found: ${c.getClassLoader}")
System.err.println(s"DEBUGME: Expected: ${root}")
System.err.println(s"DEBUGME: onClasspath: ${fromClasspath(c)}")
else
throw new ClassNotFoundException(className)
}
}
private[this] def fromClasspath(c: Class[_]): Boolean =
{