0
我想補充JsonPut & JsontPost方法在RestHelper類像波紋管相同的路徑:不能編譯代碼
object MembershipAPI extends RestHelper with LogHelper {
serve {
case JsonPost("api" :: "v1" :: "group_memberships" :: group_id :: user_id :: Nil, request) =>
() => Full(GroupMembershipController.Join(group_id, user_id, request))
case JsonPut("api" :: "v1" :: "group_memberships" :: group_id :: user_id :: Nil, request) =>
() => Full(GroupMembershipController.Join(group_id, user_id, request))
case JsonDelete("api" :: "v1" :: "group_memberships" :: group_id :: user_id :: Nil, request) =>
() => Full(GroupMembershipController.Leave(group_id, user_id, request))
}
}
而且運行SBT編譯時,我得到這個錯誤:
java.lang.Error: ch.epfl.lamp.fjbg.JCode$OffsetTooBigException: offset too big to fit in 16 bits: 51511
at ch.epfl.lamp.fjbg.JFieldOrMethod.writeTo(JFieldOrMethod.java:130)
at ch.epfl.lamp.fjbg.JClass.writeTo(JClass.java:358)
at scala.tools.nsc.backend.jvm.BytecodeWriters$ClassBytecodeWriter$class.writeClass(BytecodeWriters.scala:87)
at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anon$2.writeClass(GenJVM.scala:82)
at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.emitClass(GenJVM.scala:172)
at scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genClass(GenJVM.scala:304)
at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$4.apply(GenJVM.scala:86)
at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$4.apply(GenJVM.scala:86)
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:102)
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:102)
at scala.collection.Iterator$class.foreach(Iterator.scala:652)
at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:157)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:190)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:43)
at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:102)
at scala.tools.nsc.backend.jvm.GenJVM$JvmPhase.run(GenJVM.scala:86)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:949)
at scala.tools.nsc.Global$Run.compile(Global.scala:1034)
at xsbt.CompilerInterface.run(CompilerInterface.scala:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at xsbt.AnalyzingCompiler.call(AnalyzingCompiler.scala:40)
at xsbt.AnalyzingCompiler.apply(AnalyzingCompiler.scala:18)
at sbt.Compile.processScala(Compile.scala:76)
at sbt.CompilerCore$$anonfun$1.apply(Compile.scala:27)
at sbt.CompilerCore$$anonfun$1.apply(Compile.scala:27)
at sbt.CompilerCore$$anonfun$process$1$1.apply(Compile.scala:22)
at sbt.CompilerCore$$anonfun$process$1$1.apply(Compile.scala:22)
at sbt.CompilerCore$$anonfun$doCompile$3.apply(Compile.scala:45)
at sbt.CompilerCore$$anonfun$doCompile$3.apply(Compile.scala:42)
at scala.Option.orElse(Option.scala:102)
at sbt.CompilerCore.doCompile(Compile.scala:41)
at sbt.CompilerCore.apply(Compile.scala:29)
at sbt.AbstractCompileConditional.run$1(Conditional.scala:341)
at sbt.AbstractCompileConditional$$anonfun$3.apply(Conditional.scala:344)
at sbt.AbstractCompileConditional$$anonfun$3.apply(Conditional.scala:344)
at sbt.classfile.Analyze$.apply(Analyze.scala:110)
at sbt.AbstractCompileConditional.execute(Conditional.scala:344)
at sbt.Conditional$class.run(Conditional.scala:43)
at sbt.AbstractCompileConditional.run(Conditional.scala:231)
at sbt.BasicScalaProject.sbt$BasicScalaProject$$doCompile(DefaultProject.scala:260)
at sbt.BasicScalaProject$$anonfun$compileAction$1.apply(DefaultProject.scala:274)
at sbt.BasicScalaProject$$anonfun$compileAction$1.apply(DefaultProject.scala:274)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.doRun$1(RunTask.scala:77)
at sbt.impl.RunTask.runTask(RunTask.scala:85)
at sbt.impl.RunTask.run(RunTask.scala:32)
at sbt.impl.RunTask$.apply(RunTask.scala:17)
at sbt.impl.RunTask$.apply(RunTask.scala:16)
at sbt.Project$class.run(Project.scala:98)
at sbt.Project$class.act(Project.scala:129)
at sbt.BasicScalaProject.act(DefaultProject.scala:21)
at sbt.xMain$$anonfun$8.apply(Main.scala:530)
at sbt.xMain$$anonfun$8.apply(Main.scala:530)
at sbt.xMain.withAction(Main.scala:563)
at sbt.xMain.sbt$xMain$$handleAction(Main.scala:530)
at sbt.xMain.handleCommand(Main.scala:520)
at sbt.xMain.processAction(Main.scala:459)
at sbt.xMain.process$1(Main.scala:257)
at sbt.xMain.processArguments(Main.scala:266)
at sbt.xMain.startProject(Main.scala:107)
at sbt.xMain.run(Main.scala:84)
at sbt.xMain.run0$1(Main.scala:35)
at sbt.xMain.run(Main.scala:42)
at xsbt.boot.Launch$.run(Launch.scala:53)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
at xsbt.boot.Launch$.launch(Launch.scala:57)
at xsbt.boot.Launch$.explicit(Launch.scala:42)
at xsbt.boot.Launch$.initialized(Launch.scala:38)
at xsbt.boot.Launch$.parsed(Launch.scala:31)
at xsbt.boot.Launch$.configured(Launch.scala:21)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Launch$.apply(Launch.scala:13)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.run(Boot.scala:19)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: ch.epfl.lamp.fjbg.JCode$OffsetTooBigException: offset too big to fit in 16 bits: 51511
at ch.epfl.lamp.fjbg.JCode.checkOffset16(JCode.java:903)
at ch.epfl.lamp.fjbg.JCode.patchAllOffset(JCode.java:982)
at ch.epfl.lamp.fjbg.JCode.freeze(JCode.java:102)
at ch.epfl.lamp.fjbg.JMethod.freeze(JMethod.java:89)
at ch.epfl.lamp.fjbg.JFieldOrMethod.writeTo(JFieldOrMethod.java:127)
... 79 more
Error during sbt execution: java.lang.Error: ch.epfl.lamp.fjbg.JCode$OffsetTooBigException: offset too big to fit in 16 bits: 51511
我不知道它爲什麼會發生,以及如何能解決呢?
預先感謝您!
這也固定在2.10與虛擬模式匹配器-Yvirtpatmat –