LuciferYang commented on code in PR #44977:
URL: https://github.com/apache/spark/pull/44977#discussion_r1473858121
##########
common/utils/src/main/scala/org/apache/spark/util/ClosureCleaner.scala:
##########
@@ -610,36 +609,26 @@ private[spark] object IndylambdaScalaClosures extends
Logging {
/**
* Check if the given reference is a indylambda style Scala closure.
- * If so (e.g. for Scala 2.12+ closures), return a non-empty serialization
proxy
- * (SerializedLambda) of the closure;
- * otherwise (e.g. for Scala 2.11 closures) return None.
+ * Return a non-empty serialization proxy (SerializedLambda) of the closure.
*
* @param maybeClosure the closure to check.
*/
def getSerializationProxy(maybeClosure: AnyRef): Option[SerializedLambda] = {
- def isClosureCandidate(cls: Class[_]): Boolean = {
- // TODO: maybe lift this restriction to support other functional
interfaces in the future
- val implementedInterfaces = ClassUtils.getAllInterfaces(cls).asScala
- implementedInterfaces.exists(_.getName.startsWith("scala.Function"))
- }
-
maybeClosure.getClass match {
// shortcut the fast check:
// 1. indylambda closure classes are generated by Java's
LambdaMetafactory, and they're
// always synthetic.
// 2. We only care about Serializable closures, so let's check that as
well
case c if !c.isSynthetic || !maybeClosure.isInstanceOf[Serializable] =>
None
- case c if isClosureCandidate(c) =>
+ case _ =>
Review Comment:
cc @rednaxelafx May I ask if this modification attempt is correct? Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]