Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/17074#discussion_r122986365
--- Diff:
repl/src/test/scala/org/apache/spark/repl/ExecutorClassLoaderSuite.scala ---
@@ -77,6 +79,50 @@ class ExecutorClassLoaderSuite
}
}
+ test("child over system classloader") {
+ // JavaFileObject for scala.Option class
+ val scalaOptionFile = new SimpleJavaFileObject(
+ URI.create(s"string:///scala/Option.java"),
+ JavaFileObject.Kind.SOURCE) {
+
+ override def getCharContent(ignoreEncodingErrors: Boolean):
CharSequence = {
+ "package scala; class Option {}"
+ }
+ }
+ // compile fake scala.Option class
+ ToolProvider
+ .getSystemJavaCompiler
+ .getTask(null, null, null, null, null,
Collections.singletonList(scalaOptionFile)).call()
+
+ // create 'scala' dir in tempDir1
+ val scalaDir = new File(tempDir1, "scala")
+ assert(scalaDir.mkdir(), s"Failed to create 'scala' directory in
$tempDir1")
+
+ // move the generated class into scala dir
+ val filename = "Option.class"
--- End diff --
Why not use `createCompiledClass()` here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]