question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Signature checks fail using value classes & upgrading to 2.12.9+ or 2.13.1+

See original GitHub issue

If you publish this code with Scala 2.12.8:

class Foo(val value: String) extends AnyVal

case class Bar(foo: Foo)

And then change the Scala version to 2.12.9 (or 10) and run sbt mimaReportBinaryIssues, you’ll get these errors:

[error]  * method unapply(Bar)scala.Option in object Bar has a different signature in current version, where it is (LBar;)Lscala/Option<LFoo;>; rather than (LBar;)Lscala/Option<Ljava/lang/String;>;
[error]    filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("Bar.unapply")
[error]  * static method unapply(Bar)scala.Option in class Bar has a different signature in current version, where it is (LBar;)Lscala/Option<LFoo;>; rather than (LBar;)Lscala/Option<Ljava/lang/String;>;
[error]    filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("Bar.unapply")
[error]  * static method andThen(scala.Function1)scala.Function1 in class Bar has a different signature in current version, where it is <A:Ljava/lang/Object;>(Lscala/Function1<LBar;TA;>;)Lscala/Function1<LFoo;TA;>; rather than <A:Ljava/lang/Object;>(Lscala/Function1<LBar;TA;>;)Lscala/Function1<Ljava/lang/String;TA;>;
[error]    filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("Bar.andThen")
[error]  * static method compose(scala.Function1)scala.Function1 in class Bar has a different signature in current version, where it is <A:Ljava/lang/Object;>(Lscala/Function1<TA;LFoo;>;)Lscala/Function1<TA;LBar;>; rather than <A:Ljava/lang/Object;>(Lscala/Function1<TA;Ljava/lang/String;>;)Lscala/Function1<TA;LBar;>;
[error]    filter with: ProblemFilters.exclude[IncompatibleSignatureProblem]("Bar.compose")
[error] java.lang.RuntimeException: unapply_test: Binary compatibility check failed!

The issue seems to be the value class in the synthetic method signatures.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
dwijnandcommented, Dec 5, 2019

The fix was in the compiler (https://github.com/scala/scala/pull/8127). My understanding is that scalap shows you what’s in ScalaSignature rather than the (erased) method descriptor or the (Java) (generic) signature, the latter of which is what Harrison fixed ~and MiMa analyses~ (edit: MiMa analyses the descriptor - thanks Arnout).

1reaction
raboofcommented, Dec 5, 2019

@diesalbla no, I think it can be broken down as follows:

  • 5.1.0 was compiled with scala <2.12.9, which produced a (wrong) Eq<String> signature for a method that actually compared CipherText objects
  • Anyone who would have called that method and, based on that generic as seen by javac (scalac is separate), expected to be usable with Strings, would have encountered errors (because it in fact works with CipherText objects
  • 5.2.0 is compiled with scala >=2.12.9, which produces a (correct) Eq<CipherText> signature
  • MiMa reports that if there was anyone who relied on the Eq<String> signature before, they would be in trouble now because it changed to Eq<CipherText>.
  • But there is no-one that relied on that signature, because it was wrong and wouldn’t have worked in the first place
Read more comments on GitHub >

github_iconTop Results From Across the Web

scalameta/mdoc - Gitter
@olafurpg there seems to be an issue with 2.13. sbt docs/mdoc works fine in 2.12 but in 2.13 I get the following error:...
Read more >
What's new in Scala 2.13? - SlideShare
I will look at 5 feature areas: compiler, standard library, language changes, Future and finally the most important change the redesigned ...
Read more >
Zope2 - PyPI
Bugs reports should be made through the Zope bugtracker at ... webdav: Fixed permission check and error handling in DeleteCollection.
Read more >
dafman36-2905.pdf - Air Force Personnel Center
In conjunction with a consistent unit physical fitness training program and individual fitness training, the Physical Fitness Assessment (PFA).
Read more >
pytest Documentation - Read the Docs
How to re-run failed tests and maintain state between test runs . ... erately raising, whereas using @pytest.mark.xfail with a check ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found