This page is no longer maintained — Please continue to the home page at www.scala-lang.org

"preventing accidental overrides" error

2 replies
The Rhythmic
Joined: 2011-07-26,
User offline. Last seen 42 years 45 weeks ago.

Hi, I wrote a simple web app using Scala/Lift, and am facing this
error. Though the error seems descriptive, am not getting exactly what
to do to resolve it. Initially, the code was :

'class AuctionActor extends CometActor {'

Which was giving the error:

[ERROR] C:\WorkIsHere\LiftEcomApp\src\main\scala\org\gto\jcoe\lift\ecom
\LiftEcom
App\comet\AuctionActor.scala:57: error: type mismatch;
[INFO]  found   :
org.gto.jcoe.lift.ecom.LiftEcomApp.comet.AuctionActor
[INFO]  required: scala.actors.Actor
[INFO]         Auctioneer !? AddListener(this, this.itemId) match {
[INFO]                                   ^
[ERROR] one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
 

So, I though I can extend Actor class too, and changed the code to:

'class AuctionActor extends CometActor with Actor {'

But then it's giving the following error:

[ERROR] C:\WorkIsHere\LiftEcomApp\src\main\scala\org\gto\jcoe\lift\ecom
\LiftEcom
App\comet\AuctionActor.scala:18: error: overriding method !? in trait
LiftActor
of type (msg: Any)Any;
[INFO]  method !? in trait ActorCanReply of type (msg: Any)Any cannot
override a
 concrete member without a third member that's overridden by both
(this rule is
designed to prevent ``accidental overrides'');
[ERROR]  other members with override errors are: !!, reply, !,
exceptionHandler
[INFO] class AuctionActor extends CometActor with Actor {
[INFO]       ^
[ERROR] one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
 

Florian Hars 3
Joined: 2011-05-08,
User offline. Last seen 42 years 45 weeks ago.
Re: "preventing accidental overrides" error

On Fri, Jul 29, 2011 at 10:21:38AM -0700, Jean wrote:
> [INFO]  required: scala.actors.Actor

You're mixing actor libraries. This could work if you
meticulously keep track of which actors are lift actors
and which are scala actors (you could also throw in
some akka actors for good measure), but unless you
really need that and you really know what you are doing
you should stick to one set of actors. (Well, actually,
the type checker does the keeping track for you, as
witnessed by the error message you see.)

> 'class AuctionActor extends CometActor with Actor {'

That's like trying to persist a class with both
eclipselink and hibernate simultaneously and expecting
consistent behaviour.

- Florian.

Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: "preventing accidental overrides" error
Jean, I think you've been asked not to post Lift questions on scala-user but on the lift list.

On Fri, Jul 29, 2011 at 1:21 PM, Jean <therhythmic [at] gmail [dot] com> wrote:
Hi, I wrote a simple web app using Scala/Lift, and am facing this
error. Though the error seems descriptive, am not getting exactly what
to do to resolve it. Initially, the code was :

'class AuctionActor extends CometActor {'

Which was giving the error:

[ERROR] C:\WorkIsHere\LiftEcomApp\src\main\scala\org\gto\jcoe\lift\ecom
\LiftEcom
App\comet\AuctionActor.scala:57: error: type mismatch;
[INFO]  found   :
org.gto.jcoe.lift.ecom.LiftEcomApp.comet.AuctionActor
[INFO]  required: scala.actors.Actor
[INFO]         Auctioneer !? AddListener(this, this.itemId) match {
[INFO]                                   ^
[ERROR] one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
 



So, I though I can extend Actor class too, and changed the code to:

'class AuctionActor extends CometActor with Actor {'


But then it's giving the following error:

[ERROR] C:\WorkIsHere\LiftEcomApp\src\main\scala\org\gto\jcoe\lift\ecom
\LiftEcom
App\comet\AuctionActor.scala:18: error: overriding method !? in trait
LiftActor
of type (msg: Any)Any;
[INFO]  method !? in trait ActorCanReply of type (msg: Any)Any cannot
override a
 concrete member without a third member that's overridden by both
(this rule is
designed to prevent ``accidental overrides'');
[ERROR]  other members with override errors are: !!, reply, !,
exceptionHandler
[INFO] class AuctionActor extends CometActor with Actor {
[INFO]       ^
[ERROR] one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland