@@ -5,6 +5,7 @@ import com.typesafe.tools.mima.lib.analyze.Checker
55
66private [analyze] abstract class BaseMethodChecker extends Checker [MethodInfo , ClassInfo ] {
77 import MethodRules ._
8+ import BaseMethodChecker ._
89
910 protected val rules = Seq (AccessModifier , FinalModifier , AbstractModifier , JavaStatic )
1011
@@ -13,7 +14,7 @@ private[analyze] abstract class BaseMethodChecker extends Checker[MethodInfo, Cl
1314 if (meths.isEmpty)
1415 Some (DirectMissingMethodProblem (method))
1516 else {
16- meths.find(m => m.descriptor == method.descriptor && methSigCheck (method, m )) match {
17+ meths.find(newMethod => hasMatchingDescriptorAndSignature (method, newMethod )) match {
1718 case Some (found) => checkRules(rules)(method, found)
1819 case None =>
1920 val filtered = meths.filter(method.matchesType(_))
@@ -34,15 +35,24 @@ private[analyze] abstract class BaseMethodChecker extends Checker[MethodInfo, Cl
3435 }
3536 }
3637
37- private def methSigCheck (oldmeth : MethodInfo , newMeth : MethodInfo ): Boolean = {
38- oldmeth.signature == newMeth.signature || (
39- newMeth.bytecodeName == MemberInfo .ConstructorName && newMeth.signature.isEmpty
40- )
41- }
42-
4338 private def uniques (methods : List [MethodInfo ]): List [MethodInfo ] =
4439 methods.groupBy(_.parametersDesc).values.map(_.head).toList
4540}
41+ private [analyze] object BaseMethodChecker {
42+ def hasMatchingDescriptorAndSignature (oldMethod : MethodInfo , newMethod : MethodInfo ): Boolean =
43+ oldMethod.descriptor == newMethod.descriptor && hasMatchingSignature(oldMethod.signature, newMethod.signature, newMethod.bytecodeName)
44+
45+ // Assumes it is already checked that the descriptors match
46+ def hasMatchingSignature (oldSignature : String , newSignature : String , bytecodeName : String ): Boolean =
47+ oldSignature == newSignature ||
48+ // Special case for https://github.com/scala/scala/pull/7975:
49+ (bytecodeName == MemberInfo .ConstructorName &&
50+ (newSignature.isEmpty ||
51+ // The dropped character is the leading '('
52+ oldSignature.endsWith(newSignature.tail)
53+ )
54+ )
55+ }
4656
4757private [analyze] class ClassMethodChecker extends BaseMethodChecker {
4858 def check (method : MethodInfo , inclazz : ClassInfo ): Option [Problem ] = {
0 commit comments