Commit cd1a5ee
committed
fix(Http4s600): use lazy val to break recursive object init trap
OBPAPI6_0_0 and APIMethods600 both reference Http4s600.Implementations6_0_0
via direct getstatic. When either is loaded during Lift Boot, the JVM triggers
Implementations6_0_0.<clinit> before Http4s600.<clinit>. Impl6's <init> then
reads Http4s600.MODULE$, causing Http4s600.<clinit> to run recursively on the
same thread. The JVM spec allows this (returns the partially-initialised object),
but the strict-val assignment `wrappedRoutesV600Services = Impl6.allRoutesWithMiddleware`
executes while Impl6 is still partially initialised, reads null for
allRoutesWithMiddleware, and stores null permanently.
This made every request to Http4sApp NPE at v600Routes.run(req), causing all
v3.x/v2.x tests to see HTTP 500 on GET /banks and abort at class-init time.
Changing to `lazy val` defers the read until first access from Http4sApp
(after Boot completes and all object inits are done), at which point
Impl6.allRoutesWithMiddleware is fully assigned.1 parent fc2a3d7 commit cd1a5ee
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8489 | 8489 | | |
8490 | 8490 | | |
8491 | 8491 | | |
8492 | | - | |
| 8492 | + | |
| 8493 | + | |
| 8494 | + | |
| 8495 | + | |
| 8496 | + | |
| 8497 | + | |
| 8498 | + | |
| 8499 | + | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
8493 | 8504 | | |
8494 | 8505 | | |
0 commit comments