Invalid class generated from `StaticRoutesGenerator`

(Marcus Brito) #1


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:
    router/Routes$$anonfun$routes$1.applyOrElse(Lplay/api/mvc/RequestHeader;Lscala/Function1;)Ljava/lang/Object; @0: aload_1
    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: { }
    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?