-
-
Notifications
You must be signed in to change notification settings - Fork 51
update: use java.util.BitSet on js platform #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update: use java.util.BitSet on js platform #384
Conversation
scala.js supports java.util.BitSet since 1.9.0 https://www.scala-js.org/news/2022/02/14/announcing-scalajs-1.9.0/
620998f to
e85b165
Compare
|
I don't think we can merge this and #376. Also the tests will be very slow if we don't have the switch for isScalaJs. Can scala-native handle Java util Bitset? Finally, this will be binary incompatible. |
|
But thanks for the PR!! Hopefully we can merge some version. |
I think it would be better to switch scala.js/jvm tests based on build settings (e.g. generate util object as sbt-buildinfo do ) rather than |
|
Ah, I found portable-scala/sbt-crossproject#17. IIUC, we need to copy-paste |
|
@i10416 I'm actually about to submit a PR to fix portable-scala/sbt-crossproject#17 :)
That's true, but now that Scala.js does you can probably just copy-paste the implementation and tests and make a PR to native. That's how many things get ported to native :)
I think if you have a dependency on cats-laws in the tests you can just use this: |
Now that test iteration is switched based on js/jvm, what to do are
|
Codecov Report
@@ Coverage Diff @@
## main #384 +/- ##
==========================================
- Coverage 96.67% 96.51% -0.17%
==========================================
Files 9 9
Lines 1263 1261 -2
Branches 122 123 +1
==========================================
- Hits 1221 1217 -4
- Misses 42 44 +2
Continue to review full report at Codecov.
|
|
I think it is reasonable to release Those really should have been made |
|
FWIW I'd appreciate not bumping and preserving binary-compatibility here instead. It makes downstream cross-builds slightly more complicated when the different platforms are pinned on different versions of the same dependency (I'm thinking about http4s). Apologies if I am missing something, but why is it so hard to preserve bincompat here? Or is it just undesirable? |
|
@armanbilge I'm confused by what you mean. The only real break to binary compatibility is the symbols The other errors are for items inside the Do you think there are downstream users that care about the first two? Or is it something about using scalajs 1.9.0? |
|
FTR I completely agree that its unlikely that removing those will break any downstreams. However, it's the version bump that got my attention: it will force downstreams to also bump their versions to take on this update. |
|
okay, fair point. Let's add the isScalaJvm, isScalaJs back even though it is inelegant. We can add exclusions for the changes inside |
|
Thank you for reviewing. I will put isScalaJvm and isScalaJs back. |
Removing isScalaJs/isScalaJVM breaks binary compatibility. It is unlikely that anyone uses this API, but in order to avoid bumping minor version, we put platform check fields back to BitSetUtil for now.
| object BitSetUtil { | ||
| type Tpe = BitSet | ||
|
|
||
| @deprecated("", "0.3.7") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed here to isScalaJVM =false , isScalaJs = false because I think combination of isScalaJVM =true, isScalaJs = false, isScalaJVM =false, isScalaJs = true or isScalaJVM =true, isScalaJs = true does not make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I don't want to have a value that is false. This will be very confusing and more of a wart, if you ask me.
Can we make this the same as it was?
instead we could move the BitSet code to
private[parse] abstract class BitSetImpl {
type Tpe = BitSet
//...
}then have the js and jvm code just extend BitSetImpl something like that would maintain binary compatibility but also not have any falsehoods in the return values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead we could move the BitSet code to ...
Yeah, actually, I thought my idea was not nice too😓
That seems better solution! Thanks!
|
Mima reports binary compatibility issues due to change from scala.collection.mutable.BitSet to java.util.BitSet but it is ok to suppress them, isn't it? |
Ah, I overlooked this. |
|
Hmmm, doesn't Mima support exclude rules like |
971905d to
8a4c6e6
Compare
c832d10 to
bc9599c
Compare
8b8017e to
896ad32
Compare
896ad32 to
3168416
Compare
|
I removed deprecated annotations, which I added just in case though I didn't think someone uses |
|
There remain some mima warnings such as Should I suppress them too for now? If we would suppress them, I think we would need to remove the exclude rules in a future release as this change is from 0.3.6 to 0.3.7 only. |
|
yeah, we can suppress those errors. They are only for scalajs and they are only if for some weird reason users accessed that BitSet abstraction code, and I don't know why they would. So, I would bet it will impact exactly zero users. Also, let's add an issue to remove isScalaJs/isScalaJvm when we release a breaking change. |
|
@johnynek Just a reminder. I'm not in a hurry, of course :) |
|
Sorry I missed that you had updated this. It looks good to me. If CI is green I'll merge. Thanks so much for working so much to get this done within the binary compatibility constraints. |
|
Sooooooorry! I will fix this by tommow! 🙇 |
|
huh... the CI does not seem to be running. |
|
Strang... |
c755b58 to
e7bf32b
Compare
|
Thanks for pushing this one through! |
close #381
scala.js supports java.util.BitSet since 1.9.0