Skip to content

Commit

Permalink
[SPARK-2497] Included checks for module symbols too.
Browse files Browse the repository at this point in the history
Author: Prashant Sharma <[email protected]>

Closes apache#1463 from ScrapCodes/SPARK-2497/mima-exclude-all and squashes the following commits:

72077b1 [Prashant Sharma] Check separately for module symbols.
cd96192 [Prashant Sharma] SPARK-2497 Produce "member excludes" irrespective of the fact that class itself is excluded or not.
  • Loading branch information
ScrapCodes authored and pwendell committed Jul 31, 2014
1 parent 4fb2593 commit 5a110da
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ object GenerateMIMAIgnore {
for (className <- classes) {
try {
val classSymbol = mirror.classSymbol(Class.forName(className, false, classLoader))
val moduleSymbol = mirror.staticModule(className) // TODO: see if it is necessary.
val moduleSymbol = mirror.staticModule(className)
val directlyPrivateSpark =
isPackagePrivate(classSymbol) || isPackagePrivateModule(moduleSymbol)
val developerApi = isDeveloperApi(classSymbol)
val experimental = isExperimental(classSymbol)

val developerApi = isDeveloperApi(classSymbol) || isDeveloperApi(moduleSymbol)
val experimental = isExperimental(classSymbol) || isExperimental(moduleSymbol)
/* Inner classes defined within a private[spark] class or object are effectively
invisible, so we account for them as package private. */
lazy val indirectlyPrivateSpark = {
Expand All @@ -87,10 +86,9 @@ object GenerateMIMAIgnore {
}
if (directlyPrivateSpark || indirectlyPrivateSpark || developerApi || experimental) {
ignoredClasses += className
} else {
// check if this class has package-private/annotated members.
ignoredMembers ++= getAnnotatedOrPackagePrivateMembers(classSymbol)
}
// check if this class has package-private/annotated members.
ignoredMembers ++= getAnnotatedOrPackagePrivateMembers(classSymbol)

} catch {
case _: Throwable => println("Error instrumenting class:" + className)
Expand All @@ -115,8 +113,9 @@ object GenerateMIMAIgnore {
}

private def getAnnotatedOrPackagePrivateMembers(classSymbol: unv.ClassSymbol) = {
classSymbol.typeSignature.members
.filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) ++
classSymbol.typeSignature.members.filterNot(x =>
x.fullName.startsWith("java") || x.fullName.startsWith("scala"))
.filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) ++
getInnerFunctions(classSymbol)
}

Expand All @@ -137,8 +136,7 @@ object GenerateMIMAIgnore {
name.endsWith("$class") ||
name.contains("$sp") ||
name.contains("hive") ||
name.contains("Hive") ||
name.contains("repl")
name.contains("Hive")
}

/**
Expand Down

0 comments on commit 5a110da

Please sign in to comment.