play-json icon indicating copy to clipboard operation
play-json copied to clipboard

Scala 3 stable release

Open fgrutsch opened this issue 2 years ago • 4 comments

Hey, have you planned or considered releasing a stable version that supports Scala 3 in the near future already?

As we are heavily relying on play-json in our company and now also started to write new services in scala 3 we would like to keep play-json, but we are blocked with properly moving forward because we also use 3rd party libraries that depend on play-json like tapir-play-json which would need an update for scala 3 as well.

Is there anything blocking right now (I see there are at least 2 PRs regarding scala 3 open right now) where I/we can offer our support, as we would like to get a stable scala 3 release as soon as possible?

@mkurz mentioning you because you seem to be the main contributor right now

fgrutsch avatar Jun 07 '22 13:06 fgrutsch

Servus, my time is limited the next 3 weeks (see https://github.com/orgs/playframework/discussions/11313), however if you want to dig in and want to provide pull requests you are more than welcome to do so. I think we have RC's with Scala 3 artifacts already however. Play itself however still needs some love to finally ship Scala 3 artifacts.

mkurz avatar Jun 10 '22 14:06 mkurz

@fgrutsch There is Play JSON 2.10.0-RC6 already which does have support for Scala 3, does that work for you for now?

mkurz avatar Jul 06 '22 10:07 mkurz

@mkurz Yes, the RC works fine for us right now. It is just a little bit annoying right now to work with the RC, because as I mentioned third-party libraries that we are using can't be published as Scala 3 right now (e.g. as mentioned tapir-play-json which can't be upgraded until play-json is available for Scala 3), it is no stress though :)

I saw that the two open Sacla 3 PRs got merged now so nothing really we could have contributed in the past few weeks (it was more about offering help/support in general)

Play itself however still needs some love to finally ship Scala 3 artifacts.

Does it matter at all, or in general to be dependent on Play itself as play-json is more or less anyways standalone and has its own versioning? Or you just wanna do it at the same time then? Just curious about that

PS: I am off for the next 3 weeks

fgrutsch avatar Jul 13 '22 13:07 fgrutsch

Hi @mkurz @fgrutsch Im trying to upgrade my library to play-json with support for scala 3, even when I'm using play-json version 2.10.0-RC6

I keep getting scala 3 macro error:

[error] -- Error: /Users/hagai.ovadia/Hagai/mydev/skuber/client/src/main/scala/skuber/Scale.scala:42:55 
[error] 42 |    implicit val scaleSpecFormat: Format[Scale.Spec] = Json.format[Scale.Spec]
[error]    |                                                       ^
[error]    |Scala 2 macro cannot be used in Dotty. See https://dotty.epfl.ch/docs/reference/dropped-features/macros.html
[error]    |To turn this error into a warning, pass -Xignore-scala2-macros to the compiler

Any idea? here is my build.sbt https://github.com/hagay3/skuber/blob/fcac5026e2a200882ff15a5e99e3fca930cf692e/build.sbt

hagay3 avatar Aug 22 '22 10:08 hagay3

2.10.0-RC7 released: https://github.com/playframework/play-json/releases/tag/2.10.0-RC7 Please test this version, I will promote it to final release if everything is ok.

mkurz avatar Oct 13 '22 10:10 mkurz

@mkurz Sorry for the late response. I don't know what caused the compile issue above, maybe a local sbt issue. After testing again I'm not able to see those errors anymore. Also I was able to release skuber with Scala 3 support.

hagay3 avatar Oct 18 '22 08:10 hagay3

@mkurz Testing RC7 with Scala 3 also passes compilation and tests. https://github.com/hagay3/skuber/actions/runs/3271735985/jobs/5381881898

hagay3 avatar Oct 18 '22 08:10 hagay3

What's the status of the next release. Anything we could do to help?

vejeta avatar Nov 25 '22 12:11 vejeta

What's the status of the next release. Anything we could do to help?

Derivation using Json.format doesn't work for Scala 3 in the jsoniter-scala-benchmark project. To reproduce just need to move PlayJsonDerivedFormats object from scala-2 to scala sub-directory and try to compile with sbt jsoniter-scala-benchmarkJVM/compile.

Here is the compiler output with an error message
[error] -- Error: /home/andriy/Projects/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/PlayJsonDerivedFormats.scala:10:38 
[error] 10 |    implicit lazy val v1: Format[X] = Json.format
[error]    |                                      ^^^^^^^^^^^
[error]    |Exception occurred while executing macro expansion.
[error]    |scala.quoted.runtime.impl.ScopeException: Expression created in a splice was used outside of that splice.
[error]    |Created in: play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:431 at column 16
[error]    |Used in: play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:368 at column 42
[error]    |Expr: obj
[error]    |
[error]    |
[error]    |Creation stack:
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:431 at column 16
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:105 at column 58
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:784 at column 21
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacros.scala:78 at column 38
[error]    |
[error]    |
[error]    |Use stack:
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:368 at column 42
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:105 at column 58
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacroImpl.scala:784 at column 21
[error]    |	play-json/shared/src/main/scala-3/play/api/libs/json/JsMacros.scala:78 at column 38
[error]    |
[error]    |
[error]    |Hint: A common reason for this to happen is when a `def` that creates a `'{...}`
[error]    |      captures an outer instance of `Quotes`. If this `def` is called in a splice
[error]    |      it will not track the `Quotes` provided by that particular splice.
[error]    |      To fix it add a `given Quotes` to this `def`.
[error]    |          
[error]    |	at scala.quoted.runtime.impl.ScopeException$.checkInCorrectScope(ScopeException.scala:35)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.quotedExprToTree(PickledQuotes.scala:39)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:111)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1446)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1412)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:151)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:87)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3044)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.$anonfun$13(JsMacroImpl.scala:368)
[error]    |	at scala.collection.immutable.List.map(List.scala:246)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.readFields$1(JsMacroImpl.scala:373)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.productReads$$anonfun$1(JsMacroImpl.scala:431)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.productReads$$anonfun$adapted$1(JsMacroImpl.scala:431)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:109)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1446)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1434)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformSub(Trees.scala:1511)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1432)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1478)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1503)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1412)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:151)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:87)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3044)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.productReads(JsMacroImpl.scala:431)
[error]    |	at play.api.libs.json.JsMacroImpl$ReadsHelper.productReads$(JsMacroImpl.scala:198)
[error]    |	at play.api.libs.json.JsMacroImpl$$anon$1.productReads(JsMacroImpl.scala:127)
[error]    |	at play.api.libs.json.JsMacroImpl$.readsExpr(JsMacroImpl.scala:168)
[error]    |	at play.api.libs.json.JsMacroImpl$.$anonfun$1(JsMacroImpl.scala:105)
[error]    |	at play.api.libs.json.JsMacroImpl$.$anonfun$adapted$1(JsMacroImpl.scala:105)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:109)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1446)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1478)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1503)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1412)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:151)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:87)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3044)
[error]    |	at play.api.libs.json.JsMacroImpl$.configuredReads(JsMacroImpl.scala:105)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl$$anonfun$1(JsMacroImpl.scala:784)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl$$anonfun$adapted$1(JsMacroImpl.scala:785)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:109)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1446)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1475)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1507)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1507)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1503)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformBlock(Trees.scala:1505)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1426)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:134)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:151)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:87)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3044)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl(JsMacroImpl.scala:785)
[error]    |	at play.api.libs.json.JsMacroImpl$.format$$anonfun$1(JsMacroImpl.scala:63)
[error]    |	at play.api.libs.json.JsMacroImpl$.withSummonedConfig(JsMacroImpl.scala:79)
[error]    |	at play.api.libs.json.JsMacroImpl$.format(JsMacroImpl.scala:63)
[error]    |
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from JsMacros.scala:78
[error]     ----------------------------------------------------------------------------
[error] one error found

plokhotnyuk avatar Nov 25 '22 12:11 plokhotnyuk

When is this happening? Our company is blocked too? :(

dejvid avatar May 01 '23 08:05 dejvid

2.10.0-RC8 is now published, with Scala Native support. Please test, if nothing comes up this will promoted as final release in May.

mkurz avatar May 04 '23 16:05 mkurz

Can't use play-json 2.10.0-RC8 with Scala 3.3.0 final. please release new version 🙏

[error] error while loading package,
[error] class file play/api/libs/json/package.class is broken, reading aborted with class dotty.tools.tasty.UnpickleException
[error] TASTy signature has wrong version.
[error]  expected: {majorVersion: 28, minorVersion: 3}
[error]  found   : {majorVersion: 28, minorVersion: 3 [unstable release: 1]}
[error] 
[error] This TASTy file was produced by an unstable release.
[error] To read this TASTy file, your tooling must be at the same version.
[error] The TASTy file was produced by Scala 3.3.0-RC5.

xuwei-k avatar May 24 '23 03:05 xuwei-k

@xuwei-k :+1: release coming soon, I think it's time for prime time.

mkurz avatar May 24 '23 06:05 mkurz

Hitting same error as @xuwei-k here.

Any ETA on a 2.10,0 release?

godenji avatar May 29 '23 18:05 godenji

I did publish RC9 yesterday evening build with Scala 3.3.0. This is the last RC before final.

mkurz avatar Jun 05 '23 09:06 mkurz

2.10.0 released: https://github.com/playframework/play-json/releases/tag/2.10.0

mkurz avatar Sep 14 '23 22:09 mkurz