3
votes

I'm working through some compilation errors (in Scala / Play Framework) and one I can't resolve is a conflict error. This is the error:

class Games inherits conflicting members:

[error] method parse in trait BaseControllerHelpers of type => play.api.mvc.PlayBodyParsers and

[error] lazy value parse in trait BodyParsers of type play.api.mvc.PlayBodyParsers [error] (Note: this can be resolved by declaring an override in class Games.)

And this is the function (or class) signature for the class:

   class Games @Inject() (cc: ControllerComponents, actorSystem: ActorSystem)(val reactiveMongoApi: ReactiveMongoApi)(implicit mat: Materializer) extends AbstractController(cc) with MongoController with ReactiveMongoComponents {

In the error message you'll notice that it says that:

this can be resolved by declaring an override in class Games

But after having tried a few things - I am not sure how. If anyone has any suggestions on this or any other technique that could resolve this error please post. Thanks

There is conflict between the new (Play 2.6) AbstractController and MongoController, the former being based on the deprecated Controller trait. Play 2.6 backward compat prevent such mix of AbstractController / Controller. Until that's fix the only workaround is to remove. - cchantep
@cchantep thanks. If this is the issue why does neither the ReactiveMongo or Play Framework documentation acknowledge this? There's information on how to integrate them here - reactivemongo.org/releases/0.12/documentation/tutorial/… so why wouldn't they have tested them? Seems totally ridiculous. So is the answer not to use Play 2.6? - jesus g_force Harris
@cchantep and also - is there really no override that can resolve this? - jesus g_force Harris
I can hardly see a way with the inheritance changes in Play MVC - cchantep
@jesusg_forceHarris You can work around the issue by adding this override to your controller: override lazy val parse: PlayBodyParsers = cc.parsers - samsquanch