Skip to content
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

2.10.0-RC6 macro does not support large case class (throw ClassNotFoundException: scala.Tuple25) #728

Closed
xuwei-k opened this issue Mar 16, 2022 · 3 comments · Fixed by #729

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented Mar 16, 2022

Play JSON Version (2.5.x / etc)

2.10.0-RC6

API (Scala / Java / Neither / Both)

Scala

Operating System

all

JDK

all

Library Dependencies

only play-json 2.10.0-RC6. see following build.sbt

Expected Behavior

derive Json type classes.
play-json 2.10.0-RC5 does not have this issue if set scalacOptions += "-Xmax-inlines:100" .

Actual Behavior

throw ClassNotFoundException

TypeRepr.typeConstructorOf(Class.forName(s"scala.Tuple${types.size}"))

Reproducible Test Case

build.sbt

libraryDependencies += "com.typesafe.play" %% "play-json" % "2.10.0-RC6"

scalaVersion := "3.1.1"
package foo

case class A(
  a1: Int,
  a2: Int,
  a3: Int,
  a4: Int,
  a5: Int,
  a6: Int,
  a7: Int,
  a8: Int,
  a9: Int,
  a10: Int,
  a11: Int,
  a12: Int,
  a13: Int,
  a14: Int,
  a15: Int,
  a16: Int,
  a17: Int,
  a18: Int,
  a19: Int,
  a20: Int,
  a21: Int,
  a22: Int,
  a23: Int,
  a24: Int,
  a25: Int
)

object A {
  val format = play.api.libs.json.Json.format[A]
}
[error] 32 |  val format = play.api.libs.json.Json.format[A]
[error]    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |Exception occurred while executing macro expansion.
[error]    |java.lang.ClassNotFoundException: scala.Tuple25
[error]    |	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
[error]    |	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
[error]    |	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[error]    |	at java.lang.Class.forName0(Native Method)
[error]    |	at java.lang.Class.forName(Class.java:264)
[error]    |	at play.api.libs.json.QuotesHelper.withTuple(QuotesHelper.scala:163)
[error]    |	at play.api.libs.json.QuotesHelper.withTuple$(QuotesHelper.scala:18)
[error]    |	at play.api.libs.json.JsMacroImpl$$anon$3.withTuple(JsMacroImpl.scala:484)
[error]    |	at play.api.libs.json.JsMacroImpl$WritesHelper.productWrites(JsMacroImpl.scala:677)
[error]    |	at play.api.libs.json.JsMacroImpl$WritesHelper.productWrites$(JsMacroImpl.scala:546)
[error]    |	at play.api.libs.json.JsMacroImpl$$anon$3.productWrites(JsMacroImpl.scala:484)
[error]    |	at play.api.libs.json.JsMacroImpl$.writesExpr(JsMacroImpl.scala:516)
[error]    |	at play.api.libs.json.JsMacroImpl$.inline$writesExpr(JsMacroImpl.scala:472)
[error]    |	at play.api.libs.json.JsMacroImpl$.$anonfun$281(JsMacroImpl.scala:462)
[error]    |	at play.api.libs.json.JsMacroImpl$.$anonfun$adapted$35(JsMacroImpl.scala:462)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:81)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1430)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1410)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1469)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1500)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1500)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1498)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1410)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1410)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1500)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1500)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1396)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1410)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:121)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:60)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExpr(QuotesImpl.scala:2973)
[error]    |	at play.api.libs.json.JsMacroImpl$.configuredWrites(JsMacroImpl.scala:462)
[error]    |	at play.api.libs.json.JsMacroImpl$.inline$configuredWrites(JsMacroImpl.scala:450)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl$$anonfun$2(JsMacroImpl.scala:786)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl$$anonfun$adapted$2(JsMacroImpl.scala:786)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:81)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1430)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1464)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1500)
[error]    |	at scala.collection.immutable.List.mapConserve(List.scala:472)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1500)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1498)
[error]    |	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1410)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:106)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:121)
[error]    |	at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:60)
[error]    |	at scala.quoted.runtime.impl.QuotesImpl.unpickleExpr(QuotesImpl.scala:2973)
[error]    |	at play.api.libs.json.JsMacroImpl$.formatImpl(JsMacroImpl.scala:786)
[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]    | This location contains code that was inlined from A.scala:32
[error] one error found
@xuwei-k
Copy link
Contributor Author

xuwei-k commented Mar 16, 2022

@cchantep
Copy link
Member

Will have a look.

@cchantep
Copy link
Member

Fix @ #729

@mergify mergify bot closed this as completed in #729 Jun 22, 2022
mergify bot added a commit that referenced this issue Jun 22, 2022
Fix #728 - Support case class with more 22 fields in Scala 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants