Skip to content

Commit 807b940

Browse files
committed
Add ClassInfo.emulatedConcreteMethods
1 parent 2bb8bd1 commit 807b940

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ abstract class ClassInfo(val owner: PackageInfo) extends HasDeclarationName with
160160
else Nil
161161
}
162162

163+
/** The subset of concrete methods of this trait that are abstract at the JVM level.
164+
* This corresponds to the pre-Scala-2.12 trait encoding where all `concreteMethods`
165+
* are `emulatedConcreteMethods`. In 2.12 most concrete trait methods are translated
166+
* to concrete interface methods. */
167+
lazy val emulatedConcreteMethods: List[MemberInfo] =
168+
concreteMethods.filter(_.isDeferred)
169+
163170
/** The deferred methods of this trait */
164171
lazy val deferredMethods: List[MemberInfo] = {
165172
val concreteSet = concreteMethods.toSet

reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/Analyzer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private[analyze] class TraitAnalyzer extends Analyzer {
130130
override def analyzeNewClassMethods(oldclazz: ClassInfo, newclazz: ClassInfo): List[Problem] = {
131131
val res = collection.mutable.ListBuffer.empty[Problem]
132132

133-
for (newmeth <- newclazz.concreteMethods if newmeth.isDeferred && !oldclazz.hasStaticImpl(newmeth)) {
133+
for (newmeth <- newclazz.emulatedConcreteMethods if !oldclazz.hasStaticImpl(newmeth)) {
134134
if (!oldclazz.lookupMethods(newmeth.bytecodeName).exists(_.sig == newmeth.sig)) {
135135
// this means that the method is brand new and therefore the implementation
136136
// has to be injected

0 commit comments

Comments
 (0)