Perhaps lift this constant function closure out to a constant in the companion object? It will probably need a BC exception, though, as it might end up bytecode public.