We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ee44a3 commit f91731dCopy full SHA for f91731d
library/src/scala/quoted/Toolbox.scala
@@ -25,10 +25,10 @@ object Toolbox {
25
* @return
26
*/
27
@forceInline def make(implicit settings: Settings): Toolbox = {
28
- // TODO find the name of the class that needs to be loaded. Maybe from a stack trace.
29
-
30
- // We force inline to make forName use the classloader of the class at callsite
31
- val clazz = Class.forName("hello.Main")
+ // Get the name of the class at call site
+ val className = new Throwable().getStackTrace.head.getClassName
+ // We inline to make forName use the classloader of the class at call site
+ val clazz = Class.forName(className)
32
val cl = clazz.getClassLoader
33
make(cl)
34
}
0 commit comments