Scala模板是否有文件大小限制? [英] Is there a file size limit to the Scala templates?

查看:120
本文介绍了Scala模板是否有文件大小限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个scala模板,其中包含嵌入式硬编码图像 (例如< img src ="data:image/gif; base64,iVBORw0K ...).为了测试,我使用了相同的图像.

I have a scala template that contains embedded hard coded images (eg <img src="data:image/gif;base64,iVBORw0K... ). For testing I used the same image.

编译应用程序时,出现以下错误

When I compile the application I get the following error

java.io.IOException: invalid constant type: 106 at 119
    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)
....

但是,仅使用1张嵌入式图像进行编译时不会引发错误.

However, no error was thrown when compiling with only 1 embedded image.

所以我认为这与文件大小有关.

So I'm assuming it has to do with the file size.

是否有scala模板文件大小设置,如果可以的话如何增加它?还是我吠错了树?

Is there scala template file size setting and if so how to increase it? Or am I barking up the wrong tree?

谢谢.

推荐答案

由于引擎将模板简化为方法,并且这些方法正在jvm上编译和运行,因此任何方法的硬限制为64 kiB .模板可以比实际的模板大一些,但是最大的单个方法不能超过限制.

Because the templates are reduced to methods by the engine, and the methods are being compiled and run on the jvm there is a hard limit of 64 kiB for any method. The templates can be slightly larger than that in practice, but the largest single method may not exceed the limit.

如果您想查看模板引擎的输出以亲自检查方法,则在编译项目后,可以在<project>\target\scala-2.10\src_managed\main\views\html\...

If you want to see the output of the template engine to inspect the methods for yourself, after the project has been compiled they can be found at <project>\target\scala-2.10\src_managed\main\views\html\...

更多详细信息:

JVM方法大小限制

这篇关于Scala模板是否有文件大小限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆