Skip to content

MIMA Binary compatibility breakage updating export of val from Scala 3.7.4 -> 3.8.0-RC1 #24553

@lihaoyi

Description

@lihaoyi

Compiler version

3.8.0-RC1

Minimized code

package foo
object Foo{
  val hello = 1337
  def main(args: Array[String]): Unit = println(hello)
}

export Foo.*

Output

If you compile this code with 3.7.4 and 3.8.0-RC1 and run https://github.com/lightbend-labs/mima over the two jars, you get the following breakage report

Found 2 issue when checking against old
 * static method hello()Int in class foo.Foo#package has a different generic signature in current version, where it is ()Lscala/Function0<Ljava/lang/Object;>; rather than ()I. See https://github.com/lightbend-labs/mima#incompatiblesignatureproblem
   filter with: ProblemFilter.exclude[IncompatibleSignatureProblem]("foo.Foo#package.hello")
 * method hello()Int in object foo.Foo#package has a different generic signature in current version, where it is ()Lscala/Function0<Ljava/lang/Object;>; rather than ()I. See https://github.com/lightbend-labs/mima#incompatiblesignatureproblem
   filter with: ProblemFilter.exclude[IncompatibleSignatureProblem]("foo.Foo#package.hello")

Repro Zip:

test 2.zip

Unpack and run ./mill mimaReportBinaryIssues

Expectation

I would expect upgrading a library from Scala 3.7.4 to Scala 3.8.0-RC1 would not cause any binary compatibility breakage, so that downstream code that was previously compiled against the 3.7.4 version of the project would not hit issues compiling against the 3.8.0-RC1 version of the project

TBH I'm not sure if this MIMA-reported error is a real error or if it is a false positive. If it is a false positive, feel free to close the issue and we can add a MIMA filter to turn off this reporting. But squinting at the error message, it seems Scala 3.8.0 is messing up the generic signature somehow, reporting it as ()Lscala/Function0<Ljava/lang/Object;>; when it should be ()I

I hit this when trying to update Mill to 3.8.0-RC1 com-lihaoyi/mill#6242

Metadata

Metadata

Assignees

Labels

area:MiMaIssues tied to binary compatibility based on semantic versioning.area:exportcompat:javaitype:bugprio:highregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions