playframework - Scala override error -


i using play framework 2.2.x , securesocial , testing trying override method in superclass. getting compile error using test helper classes secure social , can not figure out not familiar scala.

what don't understand why ide things method correctly overridden when compile error. know scala not integrated ides can not see why override incorrect.

/**  *  secure social class , method trying override.      have left other methods out clarity. problem method doauth method  **/ 

package securesocial.core

import providers.utils.routeshelper import play.api.mvc.{simpleresult, anycontent, request} import play.api.{play, application, plugin} import concurrent.{await, future} import play.api.libs.ws.response  abstract class identityprovider(application: application) extends plugin registrable {  /**    * subclasses need implement authentication logic. method needs return    * user object gets passed fillprofile method    *    * @param request    * @return either result or user    * method having trouble trying override    */   def doauth()(implicit request: request[anycontent]):either[simpleresult, socialuser] } 

this class , doauth() override package testkit

import play.api.logger import securesocial.core._ import play.api.mvc.{result, request} import securesocial.core.identityid  class alwaysvalididentityprovider(app:play.api.application) extends identityprovider(app){   val logger = logger("securesocial.stubs.alwaysvalididentityprovider")   def authmethod: authenticationmethod = authenticationmethod("naive")     override def doauth()(implicit request: request[play.api.mvc.anycontent]): either[result, socialuser] ={     val userid = request.body.tostring     val r =right(socialusergenerator.socialusergen(identityid(userid, id), authmethod).sample.get)     r   }     def fillprofile(user: socialuser): socialuser = {     user   }    def id: string = "naive" } 

the error getting is: can see thinks overriding nothing.

[error] /users/zola/development/play/receipt-manager/rm-play/test/testkit/alwaysvalididentityprovider.scala:8: class alwaysvalididentityprovider needs abstract, since method doauth in class identityprovider of type [a]()(implicit request: play.api.mvc.request[a])either[play.api.mvc.result,securesocial.core.socialuser] not defined [error] class alwaysvalididentityprovider(app:play.api.application) extends identityprovider(app){ [error]       ^ [error] /users/zola/development/play/receipt-manager/rm-play/test/testkit/alwaysvalididentityprovider.scala:13: method doauth overrides nothing. [error] note: super classes of class alwaysvalididentityprovider contain following, non final members named doauth: [error] def doauth[a]()(implicit request: play.api.mvc.request[a]): either[play.api.mvc.result,securesocial.core.socialuser] [error]   override def doauth()(implicit request: request[play.api.mvc.anycontent]): either[result, socialuser] ={ [error]                ^ [error] 2 errors found 

that's because method overriding not defined. have signature in abstract class , that's it.

try instead:

def doauth()(implicit request: request[play.api.mvc.anycontent]): either[result, socialuser] ={     val userid = request.body.tostring     val r =right(socialusergenerator.socialusergen(identityid(userid, id), authmethod).sample.get)     r } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -