Skip to content

Provide script engine rendering object with parent class loader #8995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/repl/ScriptEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ScriptEngine extends AbstractScriptEngine {
"-color:never",
"-Xrepl-disable-display"
), Console.out, None)
private val rendering = new Rendering
private val rendering = new Rendering(Some(getClass.getClassLoader))
private var state: State = driver.initialState

def getFactory: ScriptEngineFactory = new ScriptEngine.Factory
Expand Down
1 change: 1 addition & 0 deletions tests/run-with-compiler/scripting.check
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
42
42
1 change: 1 addition & 0 deletions tests/run-with-compiler/scripting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ object Test {
val m = new javax.script.ScriptEngineManager(getClass().getClassLoader())
val e = m.getEngineByName("scala")
println(e.eval("42"))
println(e.eval("Some(42)").asInstanceOf[Option[Int]].get)
}
}