Github user heathermiller commented on the pull request:

    https://github.com/apache/spark/pull/1929#issuecomment-53507521
  
    Ok, so I think I have a solution. It took an embarrassing amount of 
experimentation and grokking of the REPL (not my area of expertise), but if you 
just create a dummy `Run` instance, it seems to force symbols to be initialized 
when you need them to be (i.e., classloading)
    
    So, in your implementation of `addUrlsToClassPath`, what seems to work is:
    ```scala
        def addUrlsToClassPath(urls: URL*): Unit = {
          new Run // force some initialization
          urls.foreach(_runtimeClassLoader.addNewUrl) // Add jars/classes to 
runtime for execution
          updateCompilerClassPath(urls: _*)           // Add jars/classes to 
compile time for compiling
        }
    ```
    
    After running into 10,000 walls trying to force the initialization of 
symbols in previous/current runs, I discovered this happening in Global:
    
https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/Global.scala#L754
    Which in turn forces initialization in `Run`places like:
    
https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/Global.scala#L1051
    



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to