Skip to content

Commit f9f5de4

Browse files
Andrei-Pozolotincheeseng
authored andcommitted
provide isolated child classloader to address issue:
aspectj tests are not runnable due to wrong classloader setup #42 Conflicts: org.scala-ide.sdt.scalatest/src/scala/tools/eclipse/scalatest/launching/ScalaTestLauncher.scala
1 parent 288d98a commit f9f5de4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
.project
3+
.settings/
4+
.classpath
5+
bin/
6+

org.scala-ide.sdt.scalatest/src/scala/tools/eclipse/scalatest/launching/ScalaTestLauncher.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ object ScalaTestLauncher {
99
def main(args: Array[String]) {
1010
try {
1111
val classpath = Source.fromFile(args(0)).getLines()
12+
val urls = classpath.map { cp => new File(cp.toString).toURI.toURL }.toArray
13+
val loader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader)
1214

13-
val loader = ClassLoader.getSystemClassLoader
14-
val method= classOf[URLClassLoader].getDeclaredMethod("addURL", classOf[URL]); //$NON-NLS-1$
15-
method.setAccessible(true);
16-
classpath.foreach(cp => method.invoke(loader, new File(cp).toURI.toURL))
17-
18-
val runnerClass = Class.forName("org.scalatest.tools.Runner")
15+
val runnerClass = loader.loadClass("org.scalatest.tools.Runner")
1916
val mainMethod = runnerClass.getMethod("main", args.getClass()) //$NON-NLS-1$
2017
mainMethod.setAccessible(true)
2118
mainMethod.invoke(null, Source.fromFile(args(1)).getLines().toArray)
@@ -31,4 +28,4 @@ object ScalaTestLauncher {
3128
}
3229
}
3330

34-
}
31+
}

0 commit comments

Comments
 (0)