Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Enable MIMA in build, fix binary incompatibility #195

Merged
merged 7 commits into from
Dec 19, 2016

Conversation

sritchie
Copy link
Contributor

@sritchie sritchie commented Dec 5, 2016

Looks like we have another legit binary compatibility issue. This commit is the culprit: 24fe85a

it renames Ring.fromDouble to defaultFromDouble.

[error]  * method defaultFromDouble(Double,algebra.ring.Ring,algebra.ring.MultiplicativeGroup)java.lang.Object in trait algebra.ring.RingFunctions is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("algebra.ring.RingFunctions.defaultFromDouble")
[info] core: found 1 potential binary incompatibilities while checking against org.typelevel:algebra_2.11:0.6.0
[error]  * method defaultFromDouble(Double,algebra.ring.Ring,algebra.ring.MultiplicativeGroup)java.lang.Object in trait algebra.ring.RingFunctions is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("algebra.ring.RingFunctions.defaultFromDouble")

@oscar-stripe
Copy link

Here is my solution here.

add something like:

object RingFunctions {
  implicit class AdditionalMethods[R[_]](val r: RingFunctions[R]) extends AnyVal {
    def  defaultFromDouble[T](d: Double)(implicit ....): T = ...
  }
}

then test that the old source syntax works on Ring.defaultFromDouble.

Alternatively, we could add this method to object Ring directly, which is safe.

What we should do is when we have a linear hierarchy use abstract class, which does not have this problem (that it is unsafe to add methods).

@codecov-io
Copy link

codecov-io commented Dec 5, 2016

Current coverage is 73.64% (diff: 100%)

Merging #195 into master will decrease coverage by 0.34%

@@             master       #195   diff @@
==========================================
  Files            36         37     +1   
  Lines           769        774     +5   
  Methods         708        713     +5   
  Messages          0          0          
  Branches         61         57     -4   
==========================================
+ Hits            569        570     +1   
- Misses          200        204     +4   
  Partials          0          0          

Powered by Codecov. Last update 2c5bdad...36abbaa

@sritchie
Copy link
Contributor Author

sritchie commented Dec 5, 2016

Okay, that fix seems to work locally and fix binary compatibility, @johnynek.

@sritchie sritchie changed the title Enable MIMA in build (one incompatibility remains!) Enable MIMA in build, fix binary incompatibility Dec 5, 2016
@oscar-stripe
Copy link

+1 from me. @non @tixxit @denisrosset et. al. any concerns with this approach?

@denisrosset
Copy link
Contributor

Crap, binary compatibility is indeed the most important feature of algebra.

I like the idea of AdditionalMethods in general; here, as defaultFromDouble is merely a default implementation, I'd prefer putting it in a companion object (either Ring or a package-level DefaultMethods object) and avoid piling up implicits.

@sritchie-stripe
Copy link
Contributor

@denisrosset I do prefer the companion object approach - the one thing we lose by moving it into Ring is Field.defaultFromDouble. I'm okay with that, but it may be an argument for the DefaultMethods object.

@johnynek
Copy link
Contributor

johnynek commented Dec 6, 2016 via email

@sritchie-stripe
Copy link
Contributor

@johnynek fair - and @denisrosset, we can go ahead and remove those and move the methods into the trait like you had originally done when we go to release 0.7.0. Thoughts?

@johnynek
Copy link
Contributor

johnynek commented Dec 6, 2016

we could do 0.7.0 before spire or algebird release?

@non
Copy link
Contributor

non commented Dec 7, 2016

Sure, I think doing a 0.7.0 release before Spire and Algebird release makes sense.

@denisrosset
Copy link
Contributor

+1

@sritchie
Copy link
Contributor Author

sritchie commented Dec 7, 2016

Okay, great. I bumped the version, reverted the Ring changes and disabled mima in the build so we can do the release. After that let's turn it on again!

@non
Copy link
Contributor

non commented Dec 8, 2016

👍

I am away from the machine/GPG key I used to do releases. If someone else wants to do it please feel free. Otherwise I'll release Sunday when I am back.

@sritchie
Copy link
Contributor Author

would someone mind kicking this? https://travis-ci.org/typelevel/algebra/jobs/181986215

This is a race condition in travis that I've seen before.

@johnynek
Copy link
Contributor

Kicked it on the phone. If it doesn't work we'll look tomorrow

@sritchie
Copy link
Contributor Author

Worked great. I

  • Changed the way the default implicit gets built so that it exercises this constructor
  • enabled MIMA and added a section with problems to the build, so we don't have to remember to mess with travis each time we want to allow a new binary incompatible version

@oscar-stripe
Copy link

👍

@sritchie
Copy link
Contributor Author

@non or @tixxit, if one of y'all merge and release we can get this into algebird before the next release!

@johnynek johnynek merged commit 29e4fc3 into typelevel:master Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants