Github user taroplus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17074#discussion_r123153668
  
    --- 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 --
    
    it's because createCompiledClass doesn't handle package name, it needs to 
put the generated class under 'scala' package and also it needs to move the 
generated class to 'scala' folder.
    
    Since createCompiledClass is widely used, I didn't want to touch it just 
for this very unique situation. 


---
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]

Reply via email to