Skip to content
Snippets Groups Projects
Commit 4b497a72 authored by Yin Huai's avatar Yin Huai Committed by Reynold Xin
Browse files

[SPARK-8710] [SQL] Change ScalaReflection.mirror from a val to a def.

jira: https://issues.apache.org/jira/browse/SPARK-8710

Author: Yin Huai <yhuai@databricks.com>

Closes #7094 from yhuai/SPARK-8710 and squashes the following commits:

c854baa [Yin Huai] Change ScalaReflection.mirror from a val to a def.
parent 4e880cf5
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,11 @@ import org.apache.spark.sql.types._ ...@@ -28,7 +28,11 @@ import org.apache.spark.sql.types._
*/ */
object ScalaReflection extends ScalaReflection { object ScalaReflection extends ScalaReflection {
val universe: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe val universe: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe
val mirror: universe.Mirror = universe.runtimeMirror(Thread.currentThread().getContextClassLoader) // Since we are creating a runtime mirror usign the class loader of current thread,
// we need to use def at here. So, every time we call mirror, it is using the
// class loader of the current thread.
override def mirror: universe.Mirror =
universe.runtimeMirror(Thread.currentThread().getContextClassLoader)
} }
/** /**
...@@ -39,7 +43,7 @@ trait ScalaReflection { ...@@ -39,7 +43,7 @@ trait ScalaReflection {
val universe: scala.reflect.api.Universe val universe: scala.reflect.api.Universe
/** The mirror used to access types in the universe */ /** The mirror used to access types in the universe */
val mirror: universe.Mirror def mirror: universe.Mirror
import universe._ import universe._
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment