@@ -372,6 +372,9 @@ private[spark] object ClosureCleaner extends Logging {
372372 outerThisOpt.isDefined && outerThisOpt.get.getClass.getName == capturingClassName
373373
374374 if (needsCleaning) {
375+ // indylambda closures do not reference enclosing closures via an `$outer` chain, so no
376+ // transitive cleaning is needed. Thus clean() shouldn't be recursively called with a
377+ // non-empty accessedFields.
375378 assert(accessedFields.isEmpty)
376379
377380 initAccessedFields(accessedFields, Seq (capturingClass))
@@ -486,6 +489,10 @@ private[spark] object IndylambdaScalaClosures extends Logging {
486489 writeReplace.invoke(closure).asInstanceOf [SerializedLambda ]
487490 }
488491
492+ /**
493+ * Scans an indylambda Scala closure, along with its lexically nested closures, and populate
494+ * the accessed fields info on which fields on the outer object are accessed.
495+ */
489496 def findAccessedFields (
490497 lambdaProxy : SerializedLambda ,
491498 lambdaClassLoader : ClassLoader ,
@@ -506,7 +513,6 @@ private[spark] object IndylambdaScalaClosures extends Logging {
506513
507514 val implMethodId = MethodIdentifier (
508515 implClass, lambdaProxy.getImplMethodName, lambdaProxy.getImplMethodSignature)
509- val implMethodNode = methodsByName(implMethodId)
510516
511517 val visited = Set [MethodIdentifier [_]](implMethodId)
512518 val stack = Stack [MethodIdentifier [_]](implMethodId)
0 commit comments