You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mimaExcludeAnnotations doesn't work with objects.
My understanding that Mima, when annotating some object Foo, excludes the object class (Foo$) but it doesn't exclude the static methods generated in the Foo class, which are incorrectly reported even if the object is annotated with an annotation in the mimaExcludeAnnotations list.
Here you find a patch with a failing unit test:
diff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/app/App.scala b/functional-tests/src/test/changes-in-experimental-objects-are-ok/app/App.scala
new file mode 100644
index 0000000..f283548
--- /dev/null+++ b/functional-tests/src/test/changes-in-experimental-objects-are-ok/app/App.scala@@ -0,0 +1,3 @@+object App {+ def main(args: Array[String]): Unit = ()+}diff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/problems.txt b/functional-tests/src/test/changes-in-experimental-objects-are-ok/problems.txt
new file mode 100644
index 0000000..e69de29
diff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/A.scala b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/A.scala
new file mode 100644
index 0000000..b4d97ad
--- /dev/null+++ b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/A.scala@@ -0,0 +1,9 @@+package mima+package pkg2++import mima.annotation.exclude++@exclude+object Foo {+ def foo = 1+}diff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/exclude.scala b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/exclude.scala
new file mode 100644
index 0000000..5cee6bb
--- /dev/null+++ b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v1/exclude.scala@@ -0,0 +1,5 @@+package mima.annotation++import scala.annotation.StaticAnnotation++class exclude extends StaticAnnotationdiff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/A.scala b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/A.scala
new file mode 100644
index 0000000..807edbd
--- /dev/null+++ b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/A.scala@@ -0,0 +1,7 @@+package mima+package pkg2++import mima.annotation.exclude++@exclude+object Foodiff --git a/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/exclude.scala b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/exclude.scala
new file mode 100644
index 0000000..5cee6bb
--- /dev/null+++ b/functional-tests/src/test/changes-in-experimental-objects-are-ok/v2/exclude.scala@@ -0,0 +1,5 @@+package mima.annotation++import scala.annotation.StaticAnnotation++class exclude extends StaticAnnotation
The text was updated successfully, but these errors were encountered:
Making it work for methods on the object itself is a one-line change. But Dale is looking into how hard it might be to have it also recursively apply to things nested inside the object, since that would need to work in order to remove the workaround in 14976. (And if nesting inside object is fixable, that should apply to things nested inside class, too, not just object, even though we don't have a ticket on that, I don't think.)
mimaExcludeAnnotations
doesn't work withobject
s.My understanding that Mima, when annotating some
object Foo
, excludes theobject
class (Foo$
) but it doesn't exclude thestatic
methods generated in theFoo
class, which are incorrectly reported even if the object is annotated with an annotation in themimaExcludeAnnotations
list.Here you find a patch with a failing unit test:
The text was updated successfully, but these errors were encountered: