When I use Mirror of scala 3 to generate a typeclass list, the exception occurs. I know it's the hard limit of jvm of method size, but how can I circumvent this issue.
ps: When delete some fields of Data class it works, but any other solution?
info
sbt: 1.6.0
scala: 3.1.0
error
scala.tools.asm.MethodTooLargeException: Method too large: parse/Main$. ()V while compiling
stack trace
[error] scala.tools.asm.MethodTooLargeException: Method too large: parse/Main$.<clinit> ()V
[error] scala.tools.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2087)
[error] scala.tools.asm.ClassWriter.toByteArray(ClassWriter.java:489)
[error] dotty.tools.backend.jvm.GenBCodePipeline$Worker2.getByteArray$1(GenBCode.scala:478)
[error] dotty.tools.backend.jvm.GenBCodePipeline$Worker2.addToQ3(GenBCode.scala:484)
[error] dotty.tools.backend.jvm.GenBCodePipeline$Worker2.run(GenBCode.scala:461)
[error] dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:562)
[error] dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:525)
[error] dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:63)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
[error] scala.collection.immutable.List.map(List.scala:246)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
[error] dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:71)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:289)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:222)
[error] dotty.tools.dotc.Run.compile(Run.scala:206)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)
[error]
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) scala.tools.asm.MethodTooLargeException: Method too large: parse/Main$.<clinit> ()V
[error] Total time: 2 s, completed 2022-1-5 14:11:19
code
import scala.compiletime.*
import scala.deriving.Mirror
object Main extends App {
trait FromString[A] {
def convert(str: String): A
}
object FromString {
given FromString[Int] = (str) => str.toInt
given FromString[Double] = (str) => str.toDouble
given FromString[String] = (str) => str
}
inline def getTypeclassInstances[F[_], A <: Tuple]: List[F[Any]] =
inline erasedValue[A] match {
case _: EmptyTuple => Nil
case _: (head *: tail) =>
val headTypeClass =
summonInline[F[head]]
val tailTypeClasses =
getTypeclassInstances[F, tail]
headTypeClass.asInstanceOf[F[Any]] :: getTypeclassInstances[F, tail]
}
inline def summonInstancesHelper[F[_], A](using
m: Mirror.Of[A]
): List[F[Any]] =
getTypeclassInstances[F, m.MirroredElemTypes]
case class Data(
ip: String,
method: String,
uri: String,
protocal: String,
httpStatus: Int,
byteSent: Double,
reqLength: Double,
reqTime: Double,
respTime: Double,
referer: String,
device: String
)
val types =
summonInstancesHelper[FromString, Data]
println(types.mkString("\r\n"))
}
Thanks to #bishabosha, it figures out:
reference: https://github.com/lampepfl/dotty/issues/14213
Hope it help others.
inline def getTypeclassInstances[F[_], A <: Tuple]: List[F[Any]] =
inline erasedValue[A] match {
case _: EmptyTuple => Nil
case _: (head *: tail) =>
val headTypeClass =
summonInline[F[head]]
val tailTypeClasses =
getTypeclassInstances[F, tail]
- headTypeClass.asInstanceOf[F[Any]] :: getTypeclassInstances[F, tail]
+ headTypeClass.asInstanceOf[F[Any]] :: tailTypeClasses
}
in general though this could still crash with a very large case class - perhaps you can change headTypeClass and tailTypeClasses to def instead of val.
inline def getTypeclassInstances[F[_], A <: Tuple]: List[F[Any]] =
inline erasedValue[A] match {
case _: EmptyTuple => Nil
case _: (head *: tail) =>
//use def rather than val
def headTypeClass =
summonInline[F[head]]
def tailTypeClasses =
getTypeclassInstances[F, tail]
headTypeClass.asInstanceOf[F[Any]] :: tailTypeClasses
}
Related
I need to implement the cats Show instances for an enum which express the basic operators.
enum Expr[T]:
case Plus(left: Expr[Double], right: Expr[Double]) extends Expr[Double]
case Minus(left: Expr[Double], right: Expr[Double]) extends Expr[Double]
case Num(value: Double) extends Expr[Double]
object Expr {
def eval[T](expr: Expr[T]): T =
expr match {
case Plus(left, right) => eval(left) + eval(right)
case Minus(left, right) => eval(left) - eval(right)
case Num(value) => value
}
After reading the doc, I tried to implement as following:
object ExprShow {
implicit val numShow: Show[Expr.Num] = Show.show(
num => num.value.toString
)
implicit val minusShow: Show[Expr.Minus] = Show.show(
minus => show"${minus.left} - ${minus.right}"
)
implicit val plusShow: Show[Expr.Plus] = Show.show(
plus => show"${plus.left} + ${plus.right}"
)
}
But I got the errors when trying to execute the show method:
val test = Expr.Num(3.0)
test.show
[error] -- [E007] Type Mismatch Error:
[error] 69 | minus => show"${minus.left} - ${minus.right}"
[error] | ^^^^^^^^^^
[error] | Found: (minus.left : grox.Expr[Double])
[error] | Required: cats.Show.Shown
[error] Explanation
[error] ===========
[error]
[error] Tree: minus.left
[error]
[error] I tried to show that
[error] (minus.left : grox.Expr[Double])
[error] conforms to
[error] cats.Show.Shown
[error] but the comparison trace ended with `false`:
[error]
[error] ==> (minus.left : grox.Expr[Double]) <: cats.Show.Shown
[error] ==> (minus.left : grox.Expr[Double]) <: cats.Show.Shown (recurring)
[error] ==> grox.Expr[Double] <: cats.Show.Shown (left is approximated)
[error] ==> grox.Expr[Double] <: cats.Show.Shown (recurring)
[error] <== grox.Expr[Double] <: cats.Show.Shown (recurring) = false
[error] <== grox.Expr[Double] <: cats.Show.Shown (left is approximated) = false
[error] <== (minus.left : grox.Expr[Double]) <: cats.Show.Shown (recurring) = false
[error] <== (minus.left : grox.Expr[Double]) <: cats.Show.Shown = false
[error]
[error] The tests were made under a constraint with:
[error] uninstantiated variables: A
[error] constrained types: [A](f: A => String): cats.Show[A],
[error] [A](f: A => String): cats.Show[A]
...
----------
[error] -- [E008] Not Found Error:
[error] 15 | test.show
[error] | ^^^^^^^^^
[error] | value show is not a member of grox.Expr[Double]
Is there any best practice approach to implement cats Show for enum? What's the root cause of my issue? Any suggestions or doc recommendation would be appreciated. Thanks a bunch
implicit val minusShow: Show[Expr.Minus] = Show.show(
minus => show"${minus.left} - ${minus.right}"
)
minus.left type is Expr[Double], you should define Show[Expr[Double]] first so it could find the correct implicit.
Here is the solution
implicit def exprShow[T]: Show[Expr[T]] = Show.show(
num => Expr.eval(num).toString
)
I've converted a boolean attribute of 3 case classes with following
import slick.ast.BaseTypedType
import slick.jdbc.JdbcType
import slick.jdbc.MySQLProfile.api._
import spray.json._
sealed trait Activeness {
def unary_! : Activeness = Activeness(!this.value)
override def toString: String = value.toString
def value: Boolean
}
object Activeness extends DefaultJsonProtocol {
case object Active extends Activeness {
override def value: Boolean = true
}
case object Inactive extends Activeness {
override def value: Boolean = false
}
def apply(value: Boolean): Activeness = if (value) Active else Inactive
val active: Activeness = Active
val inactive: Activeness = Inactive
implicit val activenessColumnType: JdbcType[Activeness] with BaseTypedType[Activeness] =
MappedColumnType.base[Activeness, Boolean](_.value, Activeness.apply)
implicit lazy val activenessFormat: RootJsonFormat[Activeness] = new RootJsonFormat[Activeness] {
override def write(obj: Activeness): JsValue = JsBoolean(obj.value)
override def read(json: JsValue): Activeness = {
apply(
json match {
case JsNumber(n) if n == 1 => true
case JsNumber(n) if n == 0 => false
case JsString("1") => true
case JsString("0") => false
case JsBoolean(true) => true
case JsBoolean(false) => false
case JsString("true") => true
case JsString("false") => false
case _ => deserializationError("Not a boolean")
}
)
}
}
}
code compiles fine but running sbt test I get following
[error] java.lang.AssertionError: assertion failed:
[error] static
[error] while compiling: /Users/user/project/modules/api/src/test/scala/visits/validation/VisitsValidatorTest.scala
[error] during phase: delambdafy
[error] library version: version 2.13.4
[error] compiler version: version 2.13.4
[error] reconstructed args: -bootclasspath ...
[error]
[error] last tree to typer: TypeTree(class OrderIndex)
[error] tree position: line 357 of /Users/user/project/modules/api/src/test/scala/visits/service/VisitScheduleStudyEnvironmentServiceTest.scala
[error] tree tpe: com.mdsol.strategicmonitoring.visits.model.OrderIndex
[error] symbol: (final case) class OrderIndex in package model
[error] symbol definition: final case class OrderIndex extends Product with Serializable (a ClassSymbol)
[error] symbol package: com.mdsol.strategicmonitoring.visits.model
[error] symbol owners: class OrderIndex
[error] call site: method constructMonadic in package validation
[error]
[error] == Source file context for tree position ==
[error]
[error] 354 it should "create a visit schedule for shared study" in {
[error] 355 val visitSchedule = aVisitSchedule()
[error] 356 val risk =
[error] 357 random[RiskCategoryClientDivisionScheme].copy(uuid = visitSchedule.riskCategoryCdsUuid, clientDivisionSchemeUuid = visitSchedule.clientDivisionSchemeUuid)
[error] 358 val se = random[CachedPlinthStudyEnvironment]
[error] 359 val sap = random[CachedPlinthStudyAppPartnership].copy(receiverClientDivisionSchemeUuid = visitSchedule.clientDivisionSchemeUuid)
[error] 360 mockWriteSeVisitSettingsAuth(userUri, se1Uuid)
[error] at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:170)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transformFunction(Delambdafy.scala:257)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:292)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.internal.Trees$Block.transform(Trees.scala:556)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:57)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:321)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2591)
[error] at scala.reflect.internal.Trees$Apply.transform(Trees.scala:786)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:57)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:321)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.internal.Trees$DefDef.$anonfun$transform$5(Trees.scala:453)
[error] at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:43)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:32)
[error] at scala.reflect.internal.Trees$DefDef.transform(Trees.scala:451)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:57)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:321)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.api.Trees$Transformer.$anonfun$transformStats$1(Trees.scala:2622)
[error] at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2620)
[error] at scala.reflect.internal.Trees$Template.transform(Trees.scala:544)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$1(TypingTransformers.scala:53)
[error] at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:43)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:38)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:306)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2595)
[error] at scala.reflect.internal.Trees$ClassDef.$anonfun$transform$2(Trees.scala:361)
[error] at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:43)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:32)
[error] at scala.reflect.internal.Trees$ClassDef.transform(Trees.scala:360)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:57)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:321)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:68)
[error] at scala.reflect.api.Trees$Transformer.$anonfun$transformStats$1(Trees.scala:2622)
[error] at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2620)
[error] at scala.reflect.internal.Trees$PackageDef.$anonfun$transform$1(Trees.scala:342)
[error] at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:43)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:32)
[error] at scala.reflect.internal.Trees$PackageDef.transform(Trees.scala:342)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.$anonfun$transform$2(TypingTransformers.scala:55)
[error] at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2633)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:43)
[error] at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:38)
[error] at scala.tools.nsc.transform.Delambdafy$DelambdafyTransformer.transform(Delambdafy.scala:321)
[error] at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:182)
[error] at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:32)
[error] at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
[error] at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:401)
[error] at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1515)
[error] at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1499)
[error] at scala.tools.nsc.Global$Run.compileSources(Global.scala:1491)
[error] at scala.tools.nsc.Global$Run.compileFiles(Global.scala:1605)
[error] at xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
[error] at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
[error] at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
[error] at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:186)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:176)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:157)
[error] at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:157)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:174)
[error] at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:172)
[error] at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:459)
[error] at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
[error] at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:414)
[error] at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:499)
[error] at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:401)
[error] at sbt.internal.inc.Incremental$.apply(Incremental.scala:166)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:491)
[error] at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2177)
[error] at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2134)
[error] at sbt.internal.io.Retry$.apply(Retry.scala:40)
[error] at sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2130)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (api / Test / compileIncremental) java.lang.AssertionError: assertion failed:
[error] static
[error] while compiling: /Users/user/project/modules/api/src/test/scala/visits/validation/VisitsValidatorTest.scala
[error] during phase: delambdafy
[error] library version: version 2.13.4
[error] compiler version: version 2.13.4
[error] reconstructed args: -bootclasspath ...
[error]
[error] last tree to typer: TypeTree(class OrderIndex)
[error] tree position: line 357 of /Users/user/project/modules/api/src/test/scala/visits/service/VisitScheduleStudyEnvironmentServiceTest.scala
[error] tree tpe: com.mdsol.strategicmonitoring.visits.model.OrderIndex
[error] symbol: (final case) class OrderIndex in package model
[error] symbol definition: final case class OrderIndex extends Product with Serializable (a ClassSymbol)
[error] symbol package: com.mdsol.strategicmonitoring.visits.model
[error] symbol owners: class OrderIndex
[error] call site: method constructMonadic in package validation
[error]
[error] == Source file context for tree position ==
[error]
[error] 354 it should "create a visit schedule for shared study" in {
[error] 355 val visitSchedule = aVisitSchedule()
[error] 356 val risk =
[error] 357 random[RiskCategoryClientDivisionScheme].copy(uuid = visitSchedule.riskCategoryCdsUuid, clientDivisionSchemeUuid = visitSchedule.clientDivisionSchemeUuid)
[error] 358 val se = random[CachedPlinthStudyEnvironment]
[error] 359 val sap = random[CachedPlinthStudyAppPartnership].copy(receiverClientDivisionSchemeUuid = visitSchedule.clientDivisionSchemeUuid)
[error] 360 mockWriteSeVisitSettingsAuth(userUri, se1Uuid)
[error] (api-test / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 251 s (04:11), completed Jan 31, 2021 8:11:19 PM
✔ ~/project [develop|●1✚ 46]
20:11 $
Any ideas/pointers?
I have a test app that works fine with an H2 in-memory database. Now I'm trying to connect it to our real database. I'm either getting an internal Slick exception, or a "No suitable driver" exception, depending on my approach:
Here's my simple test (which, again, seems to work fine in-memory):
"The glimple data model classes" should {
"insert a glimple row in the database" in {
val db = Database.forConfig("db.edb") // works on db.h2mem1
val glimples = TableQuery[GPGlimpleModel]
val insertGlimples = db.run(glimples += GPGlimple(None, None, 1, true, true, 1))
val count = Await.result(insertGlimples, Duration.Inf)
println(count)
count must beEqualTo(1)
...
If I turn on the connection pool, as noted here:
db.edb = {
driver = org.postgresql.Driver
url = "jdbc:postgresql://db-server-1.hyrax.com:5444/CI_0"
user = "xxx" // masked to protect the innocent
password = "xxx" // masked to protect the innocent
keepAliveConnection = true
// connectionPool = disabled
}
I end up getting the following exception. In trying to decipher what's going on, I started with a connection pool enabled (as in, "connectionPool = enabled" or just commenting that line out). That led to more problems and a very, very long exception (shown at the end of this post).
The head of that exception is:
[error] [error] java.lang.NoClassDefFoundError:
com/zaxxer/hikari/HikariConfig [error] caused by
java.lang.ClassNotFoundException: com.zaxxer.hikari.HikariConfig
And that just makes no sense to me... because again, it works just fine in-memory.
And here's the build.sbt driver line for Postgres:
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
Following is the full exception... I've posted it to github as suggested at the end of the trace:
[error] [error] java.lang.NoClassDefFoundError:
com/zaxxer/hikari/HikariConfig [error] caused by
java.lang.ClassNotFoundException: com.zaxxer.hikari.HikariConfig
[error] [error] STACKTRACE [error]
slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:141)
[error]
slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:135)
[error]
slick.jdbc.JdbcDataSource$.forConfig(JdbcDataSource.scala:35) [error]
slick.jdbc.JdbcBackend$DatabaseFactoryDef$class.forConfig(JdbcBackend.scala:223)
[error]
slick.jdbc.JdbcBackend$$anon$3.forConfig(JdbcBackend.scala:33) [error]
models.TestGlimpleModel$$anonfun$1$$anonfun$apply$64$$anonfun$apply$65.apply(TestGlimpleModel.scala:166)
[error]
models.TestGlimpleModel$$anonfun$1$$anonfun$apply$64$$anonfun$apply$65.apply(TestGlimpleModel.scala:158)
[error]
org.specs2.matcher.MatchResult$$anon$12$$anonfun$asResult$1.apply(MatchResult.scala:310)
[error]
org.specs2.matcher.MatchResult$$anon$12$$anonfun$asResult$1.apply(MatchResult.scala:310)
[error]
org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:25)
[error]
org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:120)
[error]
org.specs2.execute.Result$$anon$10.asResult(Result.scala:230) [error]
org.specs2.execute.AsResult$.apply(AsResult.scala:25) [error]
org.specs2.matcher.MatchResult$$anon$12.asResult(MatchResult.scala:310)
[error] org.specs2.execute.AsResult$.apply(AsResult.scala:25)
[error]
org.specs2.main.CommandLineAsResult$$anon$1.asResult(CommandLineAsResult.scala:17)
[error]
org.specs2.main.CommandLineAsResult$$anonfun$apply$1.apply(CommandLineAsResult.scala:21)
[error]
org.specs2.main.CommandLineAsResult$$anonfun$apply$1.apply(CommandLineAsResult.scala:21)
[error]
org.specs2.specification.dsl.mutable.ExampleDsl1$BlockExample$$anonfun$$greater$greater$1.apply(ExampleDsl.scala:39)
[error]
org.specs2.specification.dsl.mutable.ExampleDsl1$BlockExample$$anonfun$$greater$greater$1.apply(ExampleDsl.scala:39)
[error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1$$anonfun$apply$3.apply(Execution.scala:120)
[error]
org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:25)
[error]
org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:120)
[error]
org.specs2.execute.Result$$anon$10.asResult(Result.scala:230) [error]
org.specs2.execute.AsResult$.apply(AsResult.scala:25) [error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1.apply(Execution.scala:120)
[error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1.apply(Execution.scala:120)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2$$anonfun$apply$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2$$anonfun$apply$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution.setResult(Execution.scala:76)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2.apply(Execution.scala:70)
[error] scala.Option.fold(Option.scala:158) [error]
org.specs2.specification.core.Execution.execute(Execution.scala:70)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1$$anonfun$apply$6.apply(Executor.scala:132)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1$$anonfun$apply$6.apply(Executor.scala:130)
[error]
org.specs2.specification.core.Fragment.updateExecution(Fragment.scala:44)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1.apply(Executor.scala:130)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1.apply(Executor.scala:129)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1.executedFragment$lzycompute$1(Executor.scala:104)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1.org$specs2$specification$process$DefaultExecutor$class$$anonfun$$executedFragment$1(Executor.scala:104)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1$$anonfun$3.apply(Executor.scala:109)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1$$anonfun$3.apply(Executor.scala:109)
[error]
scalaz.concurrent.Task$$anonfun$delay$1.apply(Task.scala:272) [error]
scalaz.concurrent.Task$$anonfun$delay$1.apply(Task.scala:272) [error]
scalaz.concurrent.Task$$anonfun$suspend$1$$anonfun$4.apply(Task.scala:280)
[error]
scalaz.concurrent.Task$$anonfun$suspend$1$$anonfun$4.apply(Task.scala:280)
[error] scalaz.concurrent.Task$.Try(Task.scala:385) [error]
scalaz.concurrent.Task$$anonfun$suspend$1.apply(Task.scala:280)
[error]
scalaz.concurrent.Task$$anonfun$suspend$1.apply(Task.scala:280)
[error] scalaz.concurrent.Future.step(Future.scala:111) [error]
scalaz.concurrent.Future.listen(Future.scala:76) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future.runAsync(Future.scala:143) [error]
scalaz.concurrent.Future.run(Future.scala:160) [error]
scalaz.concurrent.Task.attemptRun(Task.scala:104) [error]
org.specs2.control.ActionT$.fromTask(ActionT.scala:125) [error]
org.specs2.control.ActionTSupport$class.fromTask(ActionT.scala:188)
[error]
org.specs2.control.package$Actions$.fromTask(package.scala:29) [error]
org.specs2.reporter.Reporter$$anonfun$report$1.apply(Reporter.scala:47)
[error]
org.specs2.reporter.Reporter$$anonfun$report$1.apply(Reporter.scala:37)
[error]
org.specs2.runner.SbtRunner$$anonfun$specificationRun$1$$anonfun$2.apply(SbtRunner.scala:75)
[error]
org.specs2.runner.SbtRunner$$anonfun$specificationRun$1$$anonfun$2.apply(SbtRunner.scala:75)
[error]
org.specs2.control.ActionT$$anonfun$flatMap$1$$anonfun$apply$2.apply(ActionT.scala:36)
[error]
org.specs2.control.ActionT$$anonfun$flatMap$1$$anonfun$apply$2.apply(ActionT.scala:36)
[error]
org.specs2.control.StatusT$$anonfun$flatMap$1.apply(StatusT.scala:20)
[error]
org.specs2.control.StatusT$$anonfun$flatMap$1.apply(StatusT.scala:19)
[error] scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
[error] scalaz.WriterT$$anonfun$flatMapF$1.apply(WriterT.scala:63)
[error] scalaz.WriterT$$anonfun$flatMapF$1.apply(WriterT.scala:62)
[error]
scalaz.effect.IO$$anonfun$flatMap$1$$anonfun$apply$9.apply(IO.scala:62)
[error]
scalaz.effect.IO$$anonfun$flatMap$1$$anonfun$apply$9.apply(IO.scala:61)
[error]
scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error]
scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free.resume(Free.scala:72) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.effect.IO$class.unsafePerformIO(IO.scala:22) [error]
scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error]
org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$4.execute(SbtRunner.scala:40)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:294) [error]
sbt.ForkMain$Run$2.call(ForkMain.java:284) [error]
java.util.concurrent.FutureTask.run(FutureTask.java:266) [error]
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error]
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] java.lang.Thread.run(Thread.java:745) [error] [error]
CAUSED BY java.lang.ClassNotFoundException:
com.zaxxer.hikari.HikariConfig [error]
java.net.URLClassLoader$1.run(URLClassLoader.java:372) [error]
java.net.URLClassLoader$1.run(URLClassLoader.java:361) [error]
java.security.AccessController.doPrivileged(Native Method) [error]
java.net.URLClassLoader.findClass(URLClassLoader.java:360) [error]
java.lang.ClassLoader.loadClass(ClassLoader.java:424) [error]
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [error]
java.lang.ClassLoader.loadClass(ClassLoader.java:357) [error]
slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:141)
[error]
slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:135)
[error]
slick.jdbc.JdbcDataSource$.forConfig(JdbcDataSource.scala:35) [error]
slick.jdbc.JdbcBackend$DatabaseFactoryDef$class.forConfig(JdbcBackend.scala:223)
[error]
slick.jdbc.JdbcBackend$$anon$3.forConfig(JdbcBackend.scala:33) [error]
models.TestGlimpleModel$$anonfun$1$$anonfun$apply$64$$anonfun$apply$65.apply(TestGlimpleModel.scala:166)
[error]
models.TestGlimpleModel$$anonfun$1$$anonfun$apply$64$$anonfun$apply$65.apply(TestGlimpleModel.scala:158)
[error]
org.specs2.matcher.MatchResult$$anon$12$$anonfun$asResult$1.apply(MatchResult.scala:310)
[error]
org.specs2.matcher.MatchResult$$anon$12$$anonfun$asResult$1.apply(MatchResult.scala:310)
[error]
org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:25)
[error]
org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:120)
[error]
org.specs2.execute.Result$$anon$10.asResult(Result.scala:230) [error]
org.specs2.execute.AsResult$.apply(AsResult.scala:25) [error]
org.specs2.matcher.MatchResult$$anon$12.asResult(MatchResult.scala:310)
[error] org.specs2.execute.AsResult$.apply(AsResult.scala:25)
[error]
org.specs2.main.CommandLineAsResult$$anon$1.asResult(CommandLineAsResult.scala:17)
[error]
org.specs2.main.CommandLineAsResult$$anonfun$apply$1.apply(CommandLineAsResult.scala:21)
[error]
org.specs2.main.CommandLineAsResult$$anonfun$apply$1.apply(CommandLineAsResult.scala:21)
[error]
org.specs2.specification.dsl.mutable.ExampleDsl1$BlockExample$$anonfun$$greater$greater$1.apply(ExampleDsl.scala:39)
[error]
org.specs2.specification.dsl.mutable.ExampleDsl1$BlockExample$$anonfun$$greater$greater$1.apply(ExampleDsl.scala:39)
[error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1$$anonfun$apply$3.apply(Execution.scala:120)
[error]
org.specs2.execute.ResultExecution$class.execute(ResultExecution.scala:25)
[error]
org.specs2.execute.ResultExecution$.execute(ResultExecution.scala:120)
[error]
org.specs2.execute.Result$$anon$10.asResult(Result.scala:230) [error]
org.specs2.execute.AsResult$.apply(AsResult.scala:25) [error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1.apply(Execution.scala:120)
[error]
org.specs2.specification.core.Execution$$anonfun$withEnv$1.apply(Execution.scala:120)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2$$anonfun$apply$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2$$anonfun$apply$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution.setResult(Execution.scala:76)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2.apply(Execution.scala:70)
[error]
org.specs2.specification.core.Execution$$anonfun$execute$2.apply(Execution.scala:70)
[error] scala.Option.fold(Option.scala:158) [error]
org.specs2.specification.core.Execution.execute(Execution.scala:70)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1$$anonfun$apply$6.apply(Executor.scala:132)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1$$anonfun$apply$6.apply(Executor.scala:130)
[error]
org.specs2.specification.core.Fragment.updateExecution(Fragment.scala:44)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1.apply(Executor.scala:130)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$executeFragment$1.apply(Executor.scala:129)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1.executedFragment$lzycompute$1(Executor.scala:104)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1.org$specs2$specification$process$DefaultExecutor$class$$anonfun$$executedFragment$1(Executor.scala:104)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1$$anonfun$3.apply(Executor.scala:109)
[error]
org.specs2.specification.process.DefaultExecutor$$anonfun$sequencedExecution$1$$anonfun$3.apply(Executor.scala:109)
[error]
scalaz.concurrent.Task$$anonfun$delay$1.apply(Task.scala:272) [error]
scalaz.concurrent.Task$$anonfun$delay$1.apply(Task.scala:272) [error]
scalaz.concurrent.Task$$anonfun$suspend$1$$anonfun$4.apply(Task.scala:280)
[error]
scalaz.concurrent.Task$$anonfun$suspend$1$$anonfun$4.apply(Task.scala:280)
[error] scalaz.concurrent.Task$.Try(Task.scala:385) [error]
scalaz.concurrent.Task$$anonfun$suspend$1.apply(Task.scala:280)
[error]
scalaz.concurrent.Task$$anonfun$suspend$1.apply(Task.scala:280)
[error] scalaz.concurrent.Future.step(Future.scala:111) [error]
scalaz.concurrent.Future.listen(Future.scala:76) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error]
scalaz.concurrent.Future$$anonfun$listen$1$$anonfun$apply$4.apply(Future.scala:80)
[error] scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free$$anonfun$map$1.apply(Free.scala:52) [error]
scalaz.Free.resume(Free.scala:73) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.concurrent.Future.listen(Future.scala:77) [error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:310)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2$$anonfun$apply$10.apply(Future.scala:309)
[error] scala.collection.Iterator$class.foreach(Iterator.scala:750)
[error]
scala.collection.AbstractIterator.foreach(Iterator.scala:1202) [error]
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:309)
[error]
scalaz.concurrent.Future$$anon$1$$anonfun$reduceUnordered$2.apply(Future.scala:305)
[error] scalaz.concurrent.Future.listen(Future.scala:80) [error]
scalaz.concurrent.Future.runAsync(Future.scala:143) [error]
scalaz.concurrent.Future.run(Future.scala:160) [error]
scalaz.concurrent.Task.attemptRun(Task.scala:104) [error]
org.specs2.control.ActionT$.fromTask(ActionT.scala:125) [error]
org.specs2.control.ActionTSupport$class.fromTask(ActionT.scala:188)
[error]
org.specs2.control.package$Actions$.fromTask(package.scala:29) [error]
org.specs2.reporter.Reporter$$anonfun$report$1.apply(Reporter.scala:47)
[error]
org.specs2.reporter.Reporter$$anonfun$report$1.apply(Reporter.scala:37)
[error]
org.specs2.runner.SbtRunner$$anonfun$specificationRun$1$$anonfun$2.apply(SbtRunner.scala:75)
[error]
org.specs2.runner.SbtRunner$$anonfun$specificationRun$1$$anonfun$2.apply(SbtRunner.scala:75)
[error]
org.specs2.control.ActionT$$anonfun$flatMap$1$$anonfun$apply$2.apply(ActionT.scala:36)
[error]
org.specs2.control.ActionT$$anonfun$flatMap$1$$anonfun$apply$2.apply(ActionT.scala:36)
[error]
org.specs2.control.StatusT$$anonfun$flatMap$1.apply(StatusT.scala:20)
[error]
org.specs2.control.StatusT$$anonfun$flatMap$1.apply(StatusT.scala:19)
[error] scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
[error] scalaz.WriterT$$anonfun$flatMapF$1.apply(WriterT.scala:63)
[error] scalaz.WriterT$$anonfun$flatMapF$1.apply(WriterT.scala:62)
[error]
scalaz.effect.IO$$anonfun$flatMap$1$$anonfun$apply$9.apply(IO.scala:62)
[error]
scalaz.effect.IO$$anonfun$flatMap$1$$anonfun$apply$9.apply(IO.scala:61)
[error]
scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error]
scalaz.Free$$anonfun$flatMap$1$$anonfun$apply$1.apply(Free.scala:60)
[error] scalaz.Free.resume(Free.scala:72) [error]
scalaz.Free.go2$1(Free.scala:118) [error]
scalaz.Free.go(Free.scala:122) [error]
scalaz.Free.run(Free.scala:172) [error]
scalaz.effect.IO$class.unsafePerformIO(IO.scala:22) [error]
scalaz.effect.IOFunctions$$anon$6.unsafePerformIO(IO.scala:227)
[error]
org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$4.execute(SbtRunner.scala:40)
[error] sbt.ForkMain$Run$2.call(ForkMain.java:294) [error]
sbt.ForkMain$Run$2.call(ForkMain.java:284) [error]
java.util.concurrent.FutureTask.run(FutureTask.java:266) [error]
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error]
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] java.lang.Thread.run(Thread.java:745) [error] [error]
[error] This looks like a specs2 exception... [error] Please report it
with the preceding stacktrace at
http://github.com/etorreborre/specs2/issues
One solution with basic user
on application.conf
play.modules.enabled += "modules.DatabaseModule"
MyNameIs = {
database = {
driver = org.postgresql.Driver
url = "jdbc:postgresql://localhost:5432/databasename"
user = "postgreuser"
password = ""
numThreads = 10
connectionTimeout = 5000
validationTimeout = 5000
}
dispatcher {
fork-join-executor {
parallelism-factor = 2
parallelism-max = 20
}
}
on dir app you can create database module like this
import javax.inject.{Provider, Inject, Singleton}
import com.google.inject.AbstractModule
import com.typesafe.config.Config
import play.api.inject.ApplicationLifecycle
import play.api.{Configuration, Environment}
import slick.jdbc.JdbcBackend
import scala.concurrent.Future
class DatabaseModule(environment: Environment, configuration: Configuration)
extends AbstractModule {
override def configure(): Unit = {
bind(classOf[Config]).toInstance(configuration.underlying)
bind(classOf[slick.jdbc.JdbcBackend.Database]).toProvider(classOf[DatabaseProvider])
bind(classOf[models.UserDAO]).asEagerSingleton()
}
}
#Singleton
class DatabaseProvider #Inject() (config: Config, lifecycle: ApplicationLifecycle) extends Provider[slick.jdbc.JdbcBackend.Database] {
private val db = slick.jdbc.JdbcBackend.Database.forConfig("MyNameIs.database", config)
lifecycle.addStopHook { () =>
Future.successful(db.close())
}
override def get(): JdbcBackend.DatabaseDef = db
}
On app/models: UserDAO
import java.sql.Date
import javax.inject.{Inject, Singleton}
import com.typesafe.config.Config
import slick.driver.PostgresDriver.api._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
case class User(id: Option[Long] = None, name: String, firstname: String, email: String, password: String, birthday: Option[Date] = None, signDate: Option[Date] = Some(new Date(System.currentTimeMillis)))
#Singleton
class UserDAO #Inject()(config: Config, db: Database) {
private val users = TableQuery[Users]
override def delete(ids: Long*): Future[Boolean] = {
Future.sequence(for (id <- ids) yield {
db.run(users.filter(_.id === id).delete).map(_ == 1)
}).map {
_.find(i => i == false) == None
}
}
def insert(user: User): Future[Unit] = db.run(users += user).map{()}
override def update(obj: User): Future[Boolean] = ???
override def create(obj: User): Future[Boolean] = db.run(users += obj).map(_ == 1)
override def all: Future[Seq[User]] = db.run(users.result)
private class Users(tag: slick.lifted.Tag) extends Table[User](tag, "user") {
type S = String
type D = Date
type L = Long
// attribute name in table database
def id = column[L](ID, O.AutoInc, O.PrimaryKey)
def name = column[S](NAME)
def password = column[S](PASSWORD)
def firstname = column[S](FIRSTNAME)
def email = column[S](EMAIL)
def birthday = column[D](BIRTHDAY)
def signDate = column[D](SIGN_DATE)
override def * = (id.?, name, firstname, email, password, birthday.?, signDate.?) <> ((User.apply _)
.tupled, User.unapply _)
}
}
On controllers Application.scala
#Singleton
class Application #Inject()(userdao: UserDAO) extends Controller { code }
and on route file:
# Home page
GET / #controllers.Application.index
Working example for me:
application.conf
database {
dataSourceClass = org.postgresql.ds.PGSimpleDataSource
properties = {
databaseName = "some_db"
user = "local"
password = "local"
}
numThreads = 10
}
build.sbt
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % "3.0.0",
"com.zaxxer" % "HikariCP" % "2.4.1",
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
// ...
)
And then I just call
Database.forConfig("database")
Using Java 7, Scala 2.11.6 and sbt 0.13.6.
My config with PGSimpleDataSource and specified connection pool size:
myDb = {
connectionPool = "HikariCP"
dataSourceClass = org.postgresql.ds.PGSimpleDataSource
properties = {
url = "jdbc:postgresql://"${dbHostName}":"${dbPortNumber}"/"${dbName}
user = "postgres"
password = "1"
}
numThreads = 10
minConnections = 10
maxConnections = 50
queueSize = 1000
}
I'm not sure whether its duplicate of Type Parameters on Scala Macro Annotations or not.
I'm trying to get type parameter on macro annotation:
class builder extends StaticAnnotation {
def macroTransform(annottees: Any*) = macro builderMacro.impl
}
//....
val q"new $_[$tpt]().macroTransform(..$_)" = c.macroApplication
val tpe = c.typecheck(tpt).tpe
// also tried
// val tpe = c.typecheck(q"None.asInstanceOf[$tpt]").tpe
Code that uses macro:
object Test2 {
trait TestBuilders
#builder[TestBuilders]
case class TestClass(x: Int, opt1: Option[String], opt2: Option[String]) {
val opts = (opt1, opt2)
}
}
and exception i get:
[error] scala.reflect.macros.TypecheckException: not found: type TestBuilders
[error] at scala.reflect.macros.contexts.Typers$$anonfun$typecheck$2$$anonfun$apply$1.apply(Typers.scala:34)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$typecheck$2$$anonfun$apply$1.apply(Typers.scala:28)
[error] at scala.tools.nsc.typechecker.Contexts$Context.withMode(Contexts.scala:374)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$3.apply(Typers.scala:24)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$3.apply(Typers.scala:24)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$withContext$1$1.apply(Typers.scala:25)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$withContext$1$1.apply(Typers.scala:25)
[error] at scala.tools.nsc.typechecker.Contexts$Context.withMode(Contexts.scala:374)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$1.apply(Typers.scala:23)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$1.apply(Typers.scala:23)
[error] at scala.reflect.macros.contexts.Typers$class.withContext$1(Typers.scala:25)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$typecheck$2.apply(Typers.scala:28)
[error] at scala.reflect.macros.contexts.Typers$$anonfun$typecheck$2.apply(Typers.scala:28)
[error] at scala.reflect.internal.Trees$class.wrappingIntoTerm(Trees.scala:1691)
[error] at scala.reflect.internal.SymbolTable.wrappingIntoTerm(SymbolTable.scala:16)
[error] at scala.reflect.macros.contexts.Typers$class.withWrapping$1(Typers.scala:26)
[error] at scala.reflect.macros.contexts.Typers$class.typecheck(Typers.scala:28)
[error] at scala.reflect.macros.contexts.Context.typecheck(Context.scala:6)
[error] at scala.reflect.macros.contexts.Context.typecheck(Context.scala:6)
[error] at builderMacro$.impl(Macros.scala:55)
what am i doing wrong?
This is a known issue in current macro paradise: https://github.com/scalamacros/paradise/issues/14. Note that if TestBuilders is declared in a different scope, everything should work out.
My Play 2.1.1 project uses SBT 0.12.3, and when compiling it on my dev machine, everything's fine, I get no errors, and the app runs without any issues. When I try to compile it on an EC2 instance used for testing, I get the superlong error message below. The only possibly relevant difference between the two environments is that I have java 6 (1.6.0_45) on my dev machine, and java 7 (1.7.0_19) on EC2, but I can't currently change neither. Have you ever seen something like this? What can this be about? Thanks!
[error] uncaught exception during compilation: java.lang.AssertionError
[error] (compile:compile) java.lang.AssertionError: assertion failed:
[error] while compiling: /home/ec2-user/chat/target/scala-2.10/src_managed/main/routes_routing.scala
[error] during phase: jvm
[error] library version: version 2.10.0
[error] compiler version: version 2.10.0
[error] reconstructed args: -classpath /home/ec2-user/chat/target/scala-2.10/classes:/home/ec2-user/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/play/sbt-link/2.1.1/jars/sbt-link.jar:/home/ec2-user/play-2.1.1/repository/local/org.javassist/javassist/3.16.1-GA/jars/javassist.jar:/home/ec2-user/play-2.1.1/repository/local/play/play-exceptions/2.1.1/jars/play-exceptions.jar:/home/ec2-user/play-2.1.1/repository/local/play/templates_2.10/2.1.1/jars/templates_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/com.github.scala-incubator.io/scala-io-file_2.10/0.4.2/jars/scala-io-file_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/com.github.scala-incubator.io/scala-io-core_2.10/0.4.2/jars/scala-io-core_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/com.jsuereth/scala-arm_2.10/1.3/jars/scala-arm_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/play/play-iteratees_2.10/2.1.1/jars/play-iteratees_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/org.scala-stm/scala-stm_2.10.0/0.6/jars/scala-stm_2.10.0.jar:/home/ec2-user/play-2.1.1/repository/local/com.typesafe/config/1.0.0/bundles/config.jar:/home/ec2-user/play-2.1.1/repository/local/org.slf4j/jul-to-slf4j/1.6.6/jars/jul-to-slf4j.jar:/home/ec2-user/play-2.1.1/repository/local/org.slf4j/jcl-over-slf4j/1.6.6/jars/jcl-over-slf4j.jar:/home/ec2-user/play-2.1.1/repository/local/com.typesafe.akka/akka-actor_2.10/2.1.0/bundles/akka-actor_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/com.typesafe.akka/akka-slf4j_2.10/2.1.0/bundles/akka-slf4j_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/joda-time/joda-time/2.1/jars/joda-time.jar:/home/ec2-user/play-2.1.1/repository/local/org.joda/joda-convert/1.2/jars/joda-convert.jar:/home/ec2-user/play-2.1.1/repository/local/org.apache.commons/commons-lang3/3.1/jars/commons-lang3.jar:/home/ec2-user/play-2.1.1/repository/local/com.ning/async-http-client/1.7.6/jars/async-http-client.jar:/home/ec2-user/play-2.1.1/repository/local/oauth.signpost/signpost-core/1.2.1.2/jars/signpost-core.jar:/home/ec2-user/play-2.1.1/repository/local/oauth.signpost/signpost-commonshttp4/1.2.1.2/jars/signpost-commonshttp4.jar:/home/ec2-user/play-2.1.1/repository/local/org.apache.httpcomponents/httpcore/4.0.1/jars/httpcore.jar:/home/ec2-user/play-2.1.1/repository/local/org.apache.httpcomponents/httpclient/4.0.1/jars/httpclient.jar:/home/ec2-user/play-2.1.1/repository/local/commons-logging/commons-logging/1.1.1/jars/commons-logging.jar:/home/ec2-user/play-2.1.1/repository/local/org.codehaus.jackson/jackson-core-asl/1.9.10/jars/jackson-core-asl.jar:/home/ec2-user/play-2.1.1/repository/local/org.codehaus.jackson/jackson-mapper-asl/1.9.10/jars/jackson-mapper-asl.jar:/home/ec2-user/play-2.1.1/repository/local/net.sf.ehcache/ehcache-core/2.6.0/jars/ehcache-core.jar:/home/ec2-user/play-2.1.1/repository/local/javax.transaction/jta/1.1/jars/jta.jar:/home/ec2-user/play-2.1.1/repository/local/org.scala-lang/scala-reflect/2.10.0/jars/scala-reflect.jar:/home/ec2-user/play-2.1.1/repository/local/play/play-jdbc_2.10/2.1.1/jars/play-jdbc_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/play/play-java_2.10/2.1.1/jars/play-java_2.10.jar:/home/ec2-user/play-2.1.1/repository/local/org.yaml/snakeyaml/1.10/bundles/snakeyaml.jar:/home/ec2-user/play-2.1.1/repository/local/org.hibernate/hibernate-validator/4.3.0.Final/jars/hibernate-validator.jar:/home/ec2-user/play-2.1.1/repository/local/javax.validation/validation-api/1.0.0.GA/jars/validation-api.jar:/home/ec2-user/play-2.1.1/repository/local/org.jboss.logging/jboss-logging/3.1.0.CR2/jars/jboss-logging.jar:/home/ec2-user/play-2.1.1/repository/local/org.springframework/spring-context/3.1.2.RELEASE/jars/spring-context.jar:/home/ec2-user/play-2.1.1/repository/local/org.springframework/spring-core/3.1.2.RELEASE/jars/spring-core.jar:/home/ec2-user/play-2.1.1/repository/local/org.springframework/spring-beans/3.1.2.RELEASE/jars/spring-beans.jar:/home/ec2-user/play-2.1.1/repository/local/org.reflections/reflections/0.9.8/jars/reflections.jar:/home/ec2-user/play-2.1.1/repository/local/com.google.guava/guava/13.0.1/jars/guava.jar:/home/ec2-user/play-2.1.1/repository/local/com.google.code.findbugs/jsr305/2.0.1/jars/jsr305.jar:/home/ec2-user/play-2.1.1/repository/local/javax.servlet/javax.servlet-api/3.0.1/jars/javax.servlet-api.jar:/home/ec2-user/play-2.1.1/repository/local/com.jolbox/bonecp/0.7.1.RELEASE/bundles/bonecp.jar:/home/ec2-user/play-2.1.1/repository/local/com.h2database/h2/1.3.168/jars/h2.jar:/home/ec2-user/play-2.1.1/repository/local/tyrex/tyrex/1.0.1/jars/tyrex.jar:/home/ec2-user/play-2.1.1/repository/local/play/anorm_2.10/2.1.1/jars/anorm_2.10.jar:/home/ec2-user/play-2.1.1/repository/cache/org.reactivemongo/play2-reactivemongo_2.10/jars/play2-reactivemongo_2.10-0.9.jar:/home/ec2-user/play-2.1.1/repository/cache/org.reactivemongo/reactivemongo_2.10/jars/reactivemongo_2.10-0.9.jar:/home/ec2-user/play-2.1.1/repository/cache/org.reactivemongo/reactivemongo-bson-macros_2.10/jars/reactivemongo-bson-macros_2.10-0.9.jar:/home/ec2-user/play-2.1.1/repository/cache/org.reactivemongo/reactivemongo-bson_2.10/jars/reactivemongo-bson_2.10-0.9.jar:/home/ec2-user/play-2.1.1/framework/sbt/boot/scala-2.10.0/lib/scala-compiler.jar:/home/ec2-user/play-2.1.1/repository/cache/io.netty/netty/bundles/netty-3.6.5.Final.jar:/home/ec2-user/play-2.1.1/repository/cache/ch.qos.logback/logback-core/jars/logback-core-1.0.11.jar:/home/ec2-user/play-2.1.1/repository/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.11.jar:/home/ec2-user/play-2.1.1/repository/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.4.jar:/home/ec2-user/play-2.1.1/repository/cache/org.scribe/scribe/jars/scribe-1.3.3.jar:/home/ec2-user/play-2.1.1/repository/local/commons-codec/commons-codec/1.4/jars/commons-codec.jar -encoding utf8 -deprecation -bootclasspath /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/netx.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/plugin.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.19.x86_64/jre/classes:/home/ec2-user/play-2.1.1/framework/sbt/boot/scala-2.10.0/lib/scala-library.jar -unchecked -d /home/ec2-user/chat/target/scala-2.10/classes
[error]
[error] last tree to typer: Literal(Constant(String))
[error] symbol: null
[error] symbol definition: null
[error] tpe: Class(classOf[java.lang.String])
[error] symbol owners:
[error] context owners: anonymous class anonfun$routes$1 -> package <empty>
[error]
[error] == Enclosing template or block ==
[error]
[error] Template( // val <local $anonfun>: <notype>, tree.tpe=anonfun$routes$1
[error] "scala.runtime.AbstractPartialFunction", "scala.Serializable" // parents
[error] ValDef(
[error] private
[error] "_"
[error] <tpt>
[error] <empty>
[error] )
[error] // 5 statements
[error] DefDef( // final override def applyOrElse(x$1: play.api.mvc.RequestHeader,default: Function1): Object
[error] <method> final override <triedcooking>
[error] "applyOrElse"
[error] []
[error] // 1 parameter list
[error] ValDef( // x$1: play.api.mvc.RequestHeader
[error] <param> <synthetic> <triedcooking>
[error] "x$1"
[error] <tpt> // tree.tpe=play.api.mvc.RequestHeader
[error] <empty>
[error] )
...fifteen hundred lines more of such gibberish, and finally...
[error] )
[error] )
[error] DefDef( // def <init>(): anonfun$routes$1
[error] <method> <triedcooking>
[error] "<init>"
[error] []
[error] List(Nil)
[error] <tpt> // tree.tpe=anonfun$routes$1
[error] Block( // tree.tpe=Unit
[error] Apply( // def <init>(): scala.runtime.AbstractPartialFunction in class AbstractPartialFunction, tree.tpe=scala.runtime.AbstractPartialFunction
[error] Routes$$anonfun$routes$1.super."<init>" // def <init>(): scala.runtime.AbstractPartialFunction in class AbstractPartialFunction, tree.tpe=()scala.runtime.AbstractPartialFunction
[error] Nil
[error] )
[error] ()
[error] )
[error] )
[error] )
[error]
[error] == Expanded type of tree ==
[error]
[error] ConstantType(value = Constant(String))
[error]
[error] how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: models/messages/package$Open
The reason of such behaviour described a bit here.
In my case I've just move some classes from package object to normal object, and this is solved the problem. I think you should consider transformation of models/messages/package.scala to normal object.