Skip to content

Commit 5a110da

Browse files
ScrapCodespwendell
authored andcommitted
[SPARK-2497] Included checks for module symbols too.
Author: Prashant Sharma <[email protected]> Closes #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.
1 parent 4fb2593 commit 5a110da

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

tools/src/main/scala/org/apache/spark/tools/GenerateMIMAIgnore.scala

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ object GenerateMIMAIgnore {
6868
for (className <- classes) {
6969
try {
7070
val classSymbol = mirror.classSymbol(Class.forName(className, false, classLoader))
71-
val moduleSymbol = mirror.staticModule(className) // TODO: see if it is necessary.
71+
val moduleSymbol = mirror.staticModule(className)
7272
val directlyPrivateSpark =
7373
isPackagePrivate(classSymbol) || isPackagePrivateModule(moduleSymbol)
74-
val developerApi = isDeveloperApi(classSymbol)
75-
val experimental = isExperimental(classSymbol)
76-
74+
val developerApi = isDeveloperApi(classSymbol) || isDeveloperApi(moduleSymbol)
75+
val experimental = isExperimental(classSymbol) || isExperimental(moduleSymbol)
7776
/* Inner classes defined within a private[spark] class or object are effectively
7877
invisible, so we account for them as package private. */
7978
lazy val indirectlyPrivateSpark = {
@@ -87,10 +86,9 @@ object GenerateMIMAIgnore {
8786
}
8887
if (directlyPrivateSpark || indirectlyPrivateSpark || developerApi || experimental) {
8988
ignoredClasses += className
90-
} else {
91-
// check if this class has package-private/annotated members.
92-
ignoredMembers ++= getAnnotatedOrPackagePrivateMembers(classSymbol)
9389
}
90+
// check if this class has package-private/annotated members.
91+
ignoredMembers ++= getAnnotatedOrPackagePrivateMembers(classSymbol)
9492

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

117115
private def getAnnotatedOrPackagePrivateMembers(classSymbol: unv.ClassSymbol) = {
118-
classSymbol.typeSignature.members
119-
.filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) ++
116+
classSymbol.typeSignature.members.filterNot(x =>
117+
x.fullName.startsWith("java") || x.fullName.startsWith("scala"))
118+
.filter(x => isPackagePrivate(x) || isDeveloperApi(x) || isExperimental(x)).map(_.fullName) ++
120119
getInnerFunctions(classSymbol)
121120
}
122121

@@ -137,8 +136,7 @@ object GenerateMIMAIgnore {
137136
name.endsWith("$class") ||
138137
name.contains("$sp") ||
139138
name.contains("hive") ||
140-
name.contains("Hive") ||
141-
name.contains("repl")
139+
name.contains("Hive")
142140
}
143141

144142
/**

0 commit comments

Comments
 (0)