1818package org .apache .spark .sql .catalyst .expressions .codegen
1919
2020import java .io .ByteArrayInputStream
21- import java .util .{Map => JavaMap }
2221
2322import scala .collection .JavaConverters ._
2423import scala .collection .mutable
@@ -28,8 +27,7 @@ import scala.util.control.NonFatal
2827import com .google .common .cache .{CacheBuilder , CacheLoader }
2928import com .google .common .util .concurrent .{ExecutionError , UncheckedExecutionException }
3029import org .codehaus .commons .compiler .{CompileException , InternalCompilerException }
31- import org .codehaus .commons .compiler .util .reflect .ByteArrayClassLoader
32- import org .codehaus .janino .{ClassBodyEvaluator , SimpleCompiler }
30+ import org .codehaus .janino .ClassBodyEvaluator
3331import org .codehaus .janino .util .ClassFile
3432
3533import org .apache .spark .{TaskContext , TaskKilledException }
@@ -1434,14 +1432,7 @@ object CodeGenerator extends Logging {
14341432 */
14351433 private def updateAndGetCompilationStats (evaluator : ClassBodyEvaluator ): ByteCodeStats = {
14361434 // First retrieve the generated classes.
1437- val classes = {
1438- val resultField = classOf [SimpleCompiler ].getDeclaredField(" result" )
1439- resultField.setAccessible(true )
1440- val loader = resultField.get(evaluator).asInstanceOf [ByteArrayClassLoader ]
1441- val classesField = loader.getClass.getDeclaredField(" classes" )
1442- classesField.setAccessible(true )
1443- classesField.get(loader).asInstanceOf [JavaMap [String , Array [Byte ]]].asScala
1444- }
1435+ val classes = evaluator.getBytecodes.asScala
14451436
14461437 // Then walk the classes to get at the method bytecode.
14471438 val codeAttr = Utils .classForName(" org.codehaus.janino.util.ClassFile$CodeAttribute" )
0 commit comments