diff options
author | Prashant Sharma <prashant.s@imaginea.com> | 2014-07-23 17:12:28 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-07-23 17:12:28 -0700 |
commit | 9b763329d968658d2dedee4485b7931646e6392e (patch) | |
tree | d4845dea8b45916c8f8182e483d26356b12f817b /tools/src/main/scala/org | |
parent | efdaeb111917dd0314f1d00ee8524bed1e2e21ca (diff) | |
download | spark-9b763329d968658d2dedee4485b7931646e6392e.tar.gz spark-9b763329d968658d2dedee4485b7931646e6392e.tar.bz2 spark-9b763329d968658d2dedee4485b7931646e6392e.zip |
[SPARK-2549] Functions defined inside of other functions trigger failures
Author: Prashant Sharma <prashant.s@imaginea.com>
Closes #1510 from ScrapCodes/SPARK-2549/fun-in-fun and squashes the following commits:
9458bc5 [Prashant Sharma] Tested by removing an inner function from excludes.
bc03b1c [Prashant Sharma] SPARK-2549 Functions defined inside of other functions trigger failures
Diffstat (limited to 'tools/src/main/scala/org')
-rw-r--r-- | tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala b/tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala index 03a73f92b2..566983675b 100644 --- a/tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala +++ b/tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala @@ -99,9 +99,25 @@ object GenerateMIMAIgnore { (ignoredClasses.flatMap(c => Seq(c, c.replace("$", "#"))).toSet, ignoredMembers.toSet) } + /** Scala reflection does not let us see inner function even if they are upgraded + * to public for some reason. So had to resort to java reflection to get all inner + * functions with $$ in there name. + */ + def getInnerFunctions(classSymbol: unv.ClassSymbol): Seq[String] = { + try { + Class.forName(classSymbol.fullName, false, classLoader).getMethods.map(_.getName) + .filter(_.contains("$$")).map(classSymbol.fullName + "." + _) + } catch { + case t: Throwable => + println("[WARN] Unable to detect inner functions for class:" + classSymbol.fullName) + Seq.empty[String] + } + } + private def getAnnotatedOrPackagePrivateMembers(classSymbol: unv.ClassSymbol) = { classSymbol.typeSignature.members - .filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) + .filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) ++ + getInnerFunctions(classSymbol) } def main(args: Array[String]) { @@ -121,7 +137,8 @@ object GenerateMIMAIgnore { name.endsWith("$class") || name.contains("$sp") || name.contains("hive") || - name.contains("Hive") + name.contains("Hive") || + name.contains("repl") } /** |