Invalid class generated from `StaticRoutesGenerator`

Hi,

We have a Play 2.5 application with exactly 500 routes. Things worked fine until the 499th route, but adding the 500th route breaks the application. Now every request throws this exception:

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[VerifyError: StackMapTable error: bad offset
Exception Details:
  Location:
    router/Routes$$anonfun$routes$1.applyOrElse(Lplay/api/mvc/RequestHeader;Lscala/Function1;)Ljava/lang/Object; @0: aload_1
  Reason:
    Invalid stackmap specification.
  Current Frame:
    bci: @65536
    flags: { }
    locals: { 'router/Routes$$anonfun$routes$1', 'play/api/mvc/RequestHeader', 'scala/Function1', 'play/api/mvc/RequestHeader', 'scala/Option', top, 'scala/Option' }
    stack: { }
  Bytecode:
    0x0000000: 2b4e 2ab4 0017 b600 1b2d b900 2102 003a
    ...

The error goes away if we enable the optimiser, but then build times are significantly increased and inlining code makes debugging harder. Is there any way to work around this limitation?

Did anyone ever dig into this issue? We run into precisely the same error in the process of upgrading our Play 2.5 application to Play 2.6. There is indeed a large number of routes which is compiled into one Scala source, but is there really an upper limit of routes above which the compiler simply generates illegal class files? Note that we use the InjectedRoutesGenerator and had no problems when working with Play 2.5 and Scala 2.11.8 - for Play 2.6, we updated Scala to 2.11.12.

Ok, I solved the Problem by updating from Scala 2.11 to Scala 2.12. That version seems to have solved this compiler bug. Just if anyone else stumbles upon this problem…