So I was hacking up a simple site using an off the shelf theme
boilerplate, and I started by copying the boilerplates's html into
app/views as .scala.html.
My intention was to refactor out some useful play templates with
appropriate dynamic bits, and then throw away the boilerplate.
On running the app first to make sure all the assets were hanging
together, then and browsing to it I got this:
[info] Compiling 1 Scala source to
C:\Users\brian\workspace\project\target\scala-2.10\classes...
java.io.IOException: invalid constant type: 105 at 35
at javassist.bytecode.ConstPool.readOne(ConstPool.java:1044)
at javassist.bytecode.ConstPool.read(ConstPool.java:984)
at javassist.bytecode.ConstPool.<init>(ConstPool.java:125)
at javassist.bytecode.ClassFile.read(ClassFile.java:770)
at javassist.bytecode.ClassFile.<init>(ClassFile.java:114)
at javassist.CtClassType.<init>(CtClassType.java:95)
at javassist.ClassPool.makeClass(ClassPool.java:728)
at javassist.ClassPool.makeClass(ClassPool.java:706)
at play.core.enhancers.PropertiesEnhancer.rewriteAccess(PropertiesEnhancer.java:145)
at sbt.PlayCommands$$anonfun$PostCompile$1$$anonfun$apply$32.apply(PlayCommands.scala:327)
at sbt.PlayCommands$$anonfun$PostCompile$1$$anonfun$apply$32.apply(PlayCommands.scala:327)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at sbt.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:327)
at sbt.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:305)
at sbt.Scoped$$anonfun$hf7$1.apply(Structure.scala:583)
at sbt.Scoped$$anonfun$hf7$1.apply(Structure.scala:583)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
at sbt.std.Transform$$anon$
5.work(System.scala:71)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at
sbt.Execute.work(Execute.scala:238)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
It was fun working out what caused that.
Turns out, one of the html pages (a showcase of a thousand or so
icons) was 80k in size.
This compiles to a scala template roughly the same size, and the barf
you see above happens because it's over java's 64k class file size
limit.
In normal use I guess (sincerely hope!) you'd never hit this.
I'm posting it here just because it was not obvious at all to me what
was wrong so it might help someone if the stack trace shows up in a
google search.
It might be useful to have the template compiler error out with a size
warning if it's easy to do.
regards
Brian