@@ -24,8 +24,7 @@ import java.lang.reflect.{Field, Modifier}
2424import scala .collection .mutable .{Map , Queue , Set , Stack }
2525import scala .jdk .CollectionConverters ._
2626
27- import org .apache .xbean .asm9 .{ClassReader , ClassVisitor , Handle , MethodVisitor , Type }
28- import org .apache .xbean .asm9 .Opcodes ._
27+ import org .apache .xbean .asm9 .{ClassReader , ClassVisitor , Handle , MethodVisitor , Opcodes , Type }
2928import org .apache .xbean .asm9 .tree .{ClassNode , MethodNode }
3029
3130import org .apache .spark .SparkException
@@ -671,7 +670,7 @@ private[spark] object IndylambdaScalaClosures extends Logging {
671670 * Returns true if both criteria above are met.
672671 */
673672 def isLambdaBodyCapturingOuter (handle : Handle , ownerInternalName : String ): Boolean = {
674- handle.getTag == H_INVOKESTATIC &&
673+ handle.getTag == Opcodes . H_INVOKESTATIC &&
675674 handle.getName.contains(" $anonfun$" ) &&
676675 handle.getOwner == ownerInternalName &&
677676 handle.getDesc.startsWith(s " (L $ownerInternalName; " )
@@ -686,7 +685,7 @@ private[spark] object IndylambdaScalaClosures extends Logging {
686685 */
687686 def isInnerClassCtorCapturingOuter (
688687 op : Int , owner : String , name : String , desc : String , callerInternalName : String ): Boolean = {
689- op == INVOKESPECIAL && name == " <init>" && desc.startsWith(s " (L $callerInternalName; " )
688+ op == Opcodes . INVOKESPECIAL && name == " <init>" && desc.startsWith(s " (L $callerInternalName; " )
690689 }
691690
692691 /**
@@ -882,14 +881,14 @@ private[spark] object IndylambdaScalaClosures extends Logging {
882881 addAmmoniteCommandFieldsToTracking(currentClass)
883882 val currentMethodNode = methodNodeById(currentId)
884883 logTrace(s " scanning ${currentId.cls.getName}. ${currentId.name}${currentId.desc}" )
885- currentMethodNode.accept(new MethodVisitor (ASM9 ) {
884+ currentMethodNode.accept(new MethodVisitor (Opcodes . ASM9 ) {
886885 val currentClassName = currentClass.getName
887886 val currentClassInternalName = currentClassName.replace('.' , '/' )
888887
889888 // Find and update the accessedFields info. Only fields on known outer classes are tracked.
890889 // This is the FieldAccessFinder equivalent.
891890 override def visitFieldInsn (op : Int , owner : String , name : String , desc : String ): Unit = {
892- if (op == GETFIELD || op == PUTFIELD ) {
891+ if (op == Opcodes . GETFIELD || op == Opcodes . PUTFIELD ) {
893892 val ownerExternalName = owner.replace('/' , '.' )
894893 for (cl <- accessedFields.keys if cl.getName == ownerExternalName) {
895894 logTrace(s " found field access $name on $ownerExternalName" )
@@ -970,7 +969,7 @@ private[spark] class ReturnStatementInClosureException
970969 extends SparkException (" Return statements aren't allowed in Spark closures" )
971970
972971private class ReturnStatementFinder (targetMethodName : Option [String ] = None )
973- extends ClassVisitor (ASM9 ) {
972+ extends ClassVisitor (Opcodes . ASM9 ) {
974973 override def visitMethod (access : Int , name : String , desc : String ,
975974 sig : String , exceptions : Array [String ]): MethodVisitor = {
976975
@@ -984,15 +983,16 @@ private class ReturnStatementFinder(targetMethodName: Option[String] = None)
984983 val isTargetMethod = targetMethodName.isEmpty ||
985984 name == targetMethodName.get || name == targetMethodName.get.stripSuffix(" $adapted" )
986985
987- new MethodVisitor (ASM9 ) {
986+ new MethodVisitor (Opcodes . ASM9 ) {
988987 override def visitTypeInsn (op : Int , tp : String ): Unit = {
989- if (op == NEW && tp.contains(" scala/runtime/NonLocalReturnControl" ) && isTargetMethod) {
988+ if (op == Opcodes .NEW && tp.contains(" scala/runtime/NonLocalReturnControl" ) &&
989+ isTargetMethod) {
990990 throw new ReturnStatementInClosureException
991991 }
992992 }
993993 }
994994 } else {
995- new MethodVisitor (ASM9 ) {}
995+ new MethodVisitor (Opcodes . ASM9 ) {}
996996 }
997997 }
998998}
@@ -1016,7 +1016,7 @@ private[util] class FieldAccessFinder(
10161016 findTransitively : Boolean ,
10171017 specificMethod : Option [MethodIdentifier [_]] = None ,
10181018 visitedMethods : Set [MethodIdentifier [_]] = Set .empty)
1019- extends ClassVisitor (ASM9 ) {
1019+ extends ClassVisitor (Opcodes . ASM9 ) {
10201020
10211021 override def visitMethod (
10221022 access : Int ,
@@ -1031,9 +1031,9 @@ private[util] class FieldAccessFinder(
10311031 return null
10321032 }
10331033
1034- new MethodVisitor (ASM9 ) {
1034+ new MethodVisitor (Opcodes . ASM9 ) {
10351035 override def visitFieldInsn (op : Int , owner : String , name : String , desc : String ): Unit = {
1036- if (op == GETFIELD ) {
1036+ if (op == Opcodes . GETFIELD ) {
10371037 for (cl <- fields.keys if cl.getName == owner.replace('/' , '.' )) {
10381038 fields(cl) += name
10391039 }
@@ -1045,7 +1045,7 @@ private[util] class FieldAccessFinder(
10451045 for (cl <- fields.keys if cl.getName == owner.replace('/' , '.' )) {
10461046 // Check for calls a getter method for a variable in an interpreter wrapper object.
10471047 // This means that the corresponding field will be accessed, so we should save it.
1048- if (op == INVOKEVIRTUAL && owner.endsWith(" $iwC" ) && ! name.endsWith(" $outer" )) {
1048+ if (op == Opcodes . INVOKEVIRTUAL && owner.endsWith(" $iwC" ) && ! name.endsWith(" $outer" )) {
10491049 fields(cl) += name
10501050 }
10511051 // Optionally visit other methods to find fields that are transitively referenced
@@ -1071,7 +1071,7 @@ private[util] class FieldAccessFinder(
10711071 }
10721072}
10731073
1074- private class InnerClosureFinder (output : Set [Class [_]]) extends ClassVisitor (ASM9 ) {
1074+ private class InnerClosureFinder (output : Set [Class [_]]) extends ClassVisitor (Opcodes . ASM9 ) {
10751075 var myName : String = null
10761076
10771077 // TODO: Recursively find inner closures that we indirectly reference, e.g.
@@ -1086,11 +1086,11 @@ private class InnerClosureFinder(output: Set[Class[_]]) extends ClassVisitor(ASM
10861086
10871087 override def visitMethod (access : Int , name : String , desc : String ,
10881088 sig : String , exceptions : Array [String ]): MethodVisitor = {
1089- new MethodVisitor (ASM9 ) {
1089+ new MethodVisitor (Opcodes . ASM9 ) {
10901090 override def visitMethodInsn (
10911091 op : Int , owner : String , name : String , desc : String , itf : Boolean ): Unit = {
10921092 val argTypes = Type .getArgumentTypes(desc)
1093- if (op == INVOKESPECIAL && name == " <init>" && argTypes.length > 0
1093+ if (op == Opcodes . INVOKESPECIAL && name == " <init>" && argTypes.length > 0
10941094 && argTypes(0 ).toString.startsWith(" L" ) // is it an object?
10951095 && argTypes(0 ).getInternalName == myName) {
10961096 output += SparkClassUtils .classForName(
0 commit comments