Skip to content

Commit c47aa70

Browse files
committed
Unpickle package-private from TASTy
Meaning package private things will be automatically filtered.
1 parent 1bc783e commit c47aa70

File tree

32 files changed

+197
-142
lines changed

32 files changed

+197
-142
lines changed

core/src/main/scala/com/typesafe/tools/mima/core/ClassInfo.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ private[mima] sealed abstract class ClassInfo(val owner: PackageInfo) extends In
8787
final def isInterface: Boolean = ClassfileParser.isInterface(flags) // java interface or trait w/o impl methods
8888
final def isClass: Boolean = !isTrait && !isInterface // class, object or trait's impl class
8989

90-
final def accessModifier: String = if (isProtected) "protected" else if (isPrivate) "private" else ""
90+
final def scopedPrivateSuff: String = if (isScopedPrivate) "[..]" else ""
91+
final def accessModifier: String = if (isProtected) s"protected$scopedPrivateSuff" else if (isPrivate) s"private$scopedPrivateSuff" else ""
9192
final def declarationPrefix: String = if (isModuleClass) "object" else if (isTrait) "trait" else if (isInterface) "interface" else "class"
9293
final lazy val fullName: String = if (owner.isRoot) bytecodeName else s"${owner.fullName}.$bytecodeName"
9394
final def formattedFullName: String = formatClassName(if (isModuleClass) fullName.init else fullName)

core/src/main/scala/com/typesafe/tools/mima/core/MemberInfo.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ sealed abstract class MemberInfo(val owner: ClassInfo, val bytecodeName: String,
1515

1616
final def fullName: String = s"${owner.formattedFullName}.$decodedName"
1717
final def abstractPrefix = if (isDeferred && !owner.isTrait) "abstract " else ""
18+
final def scopedPrivatePrefix = if (scopedPrivate) "private[..] " else ""
1819
final def staticPrefix: String = if (isStatic) "static " else ""
1920
final def tpe: Type = owner.owner.definitions.fromDescriptor(descriptor)
2021
final def hasSyntheticName: Boolean = decodedName.contains('$')
@@ -43,7 +44,7 @@ private[mima] final class MethodInfo(owner: ClassInfo, bytecodeName: String, fla
4344
def shortMethodString: String = {
4445
val prefix = if (hasSyntheticName) if (isExtensionMethod) "extension " else "synthetic " else ""
4546
val deprecated = if (isDeprecated) "deprecated " else ""
46-
s"${abstractPrefix}$prefix${deprecated}${staticPrefix}method $decodedName$tpe"
47+
s"${scopedPrivatePrefix}${abstractPrefix}$prefix${deprecated}${staticPrefix}method $decodedName$tpe"
4748
}
4849

4950
lazy val paramsCount: Int = {

core/src/main/scala/com/typesafe/tools/mima/core/MimaUnpickler.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ object MimaUnpickler {
1818
val index = buf.createIndex
1919
val entries = new Array[Entry](index.length)
2020
val classes = new scala.collection.mutable.HashMap[SymInfo, ClassInfo]
21-
def nnSyms = entries.iterator.collect { case s: SymbolInfo => s }
22-
def defnSyms = nnSyms.filter(sym => sym.tag == CLASSsym || sym.tag == MODULEsym)
23-
def methSyms = nnSyms.filter(sym => sym.tag == VALsym)
21+
def syms = entries.iterator.collect { case s: SymbolInfo => s }
22+
def defnSyms = syms.filter(sym => sym.tag == CLASSsym || sym.tag == MODULEsym)
23+
def methSyms = syms.filter(sym => sym.tag == VALsym)
2424

2525
def until[T](end: Int, op: () => T): List[T] =
2626
if (buf.readIndex == end) Nil else op() :: until(end, op)
@@ -177,7 +177,7 @@ object MimaUnpickler {
177177
.filter(_.name.value != CONSTRUCTOR) // TODO support package private constructors
178178
.toSeq.groupBy(_.name).foreach { case (name, pickleMethods) =>
179179
doMethodOverloads(clazz, name, pickleMethods)
180-
}
180+
}
181181
}
182182

183183
def doMethodOverloads(clazz: ClassInfo, name: Name, pickleMethods: Seq[SymbolInfo]) = {

core/src/main/scala/com/typesafe/tools/mima/core/TastyFormat.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,14 @@ object TastyFormat {
173173
* ANNOTATEDtype Length underlying_Type annotation_Term -- underlying @ annotation
174174
* ANDtype Length left_Type right_Type -- left & right
175175
* ORtype Length left_Type right_Type -- lefgt | right
176-
* MATCHtype Length bound_Type sel_Type case_Type* -- sel match {cases} with optional upper `bound`
176+
* MATCHtype Length bound_Type sel_Type case_Type* -- sel match {cases} with optional upper `bound`
177177
* MATCHCASEtype Length pat_type rhs_Type -- match cases are MATCHCASEtypes or TYPELAMBDAtypes over MATCHCASEtypes
178178
* BIND Length boundName_NameRef bounds_Type Modifier* -- boundName @ bounds, for type-variables defined in a type pattern
179179
* BYNAMEtype underlying_Type -- => underlying
180180
* PARAMtype Length binder_ASTRef paramNum_Nat -- A reference to parameter # paramNum in lambda type `binder`
181181
* POLYtype Length result_Type TypesNames -- A polymorphic method type `[TypesNames]result`, used in refinements
182182
* METHODtype Length result_Type TypesNames Modifier* -- A method type `(Modifier* TypesNames)result`, needed for refinements, with optional modifiers for the parameters
183183
* TYPELAMBDAtype Length result_Type TypesNames -- A type lambda `[TypesNames] => result`
184-
* SHAREDtype type_ASTRef -- link to previously serialized type
185184
* TypesNames = TypeName*
186185
* TypeName = typeOrBounds_ASTRef paramName_NameRef -- (`termName`: `type`) or (`typeName` `bounds`)
187186
*

0 commit comments

Comments
 (0)