Skip to content

Commit

Permalink
SPARK-2549 Functions defined inside of other functions trigger failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrapCodes committed Jul 23, 2014
1 parent 02e4572 commit bc03b1c
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 getInnerFunc(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("Error detecting 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) ++
getInnerFunc(classSymbol)
}

def main(args: Array[String]) {
Expand Down

0 comments on commit bc03b1c

Please sign in to comment.