Skip to content

Commit

Permalink
Merge pull request #198 from nick-nachos/wip-196-newInheritedMethodMa…
Browse files Browse the repository at this point in the history
…tchingFix

Match inherited abstract methods against inheriting class #196
  • Loading branch information
2m authored Oct 9, 2017
2 parents 8724e4f + 886afbd commit 9d5899e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ case class IncompatibleResultTypeProblem(oldmeth: MemberInfo, newmeth: MemberInf
// into two, in case the affected version is the other one, rather than the current one. (reversed if forward check).
abstract class AbstractMethodProblem(newmeth: MemberInfo) extends MemberProblem(newmeth)

case class InheritedNewAbstractMethodProblem(clazz: ClassInfo, inheritedMethod: MemberInfo) extends AbstractMethodProblem(inheritedMethod) {
case class InheritedNewAbstractMethodProblem(clazz: ClassInfo, inheritedMethod: MemberInfo)
extends AbstractMethodProblem(new MemberInfo(clazz, inheritedMethod.bytecodeName, inheritedMethod.flags, inheritedMethod.sig)) {
def description = affectedVersion => "abstract " + inheritedMethod.methodString+ " is inherited by class " + clazz.bytecodeName + " in " + affectedVersion + " version."
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import com.typesafe.tools.mima.core._

mimaPreviousArtifacts := Set(organization.value %% name.value % "0.0.1-SNAPSHOT")
mimaBinaryIssueFilters := Seq(
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("A.bar")
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % System.getProperty("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract class A {
def foo = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trait T {
def bar
}

abstract class A extends T {
def foo = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
> set scalaSource in Compile := baseDirectory.value /"src" /"main" /"scala" /"v1"
> set version := s"0.0.1-SNAPSHOT"
> publishLocal

> set scalaSource in Compile := baseDirectory.value /"src" /"main" /"scala" /"v2"
> set version := s"0.0.2-SNAPSHOT"

# filters are set in the build file, so mima check should pass
> mimaReportBinaryIssues

# remove all filters so mima check fails
> set mimaBinaryIssueFilters := Seq.empty
-> mimaReportBinaryIssues

0 comments on commit 9d5899e

Please sign in to comment.