Best Regards
Edmondo
Is it extending a class where that method is defined as returning a
type parameter? For example:
class A[T] { def f: T }
class B extends A[Unit]
In that case, the method f must return Object because of erasure, and
the erasure of Unit is BoxedUnit.
--
Daniel C. Sobral
I travel to the future all the time.
In this framework I define an eventHandler in the following way
@EventDriven
class MyEventDrivenClass {
@EventHandler def handler (event:MyDomainObject)
@EventTemplate def template:MyDomainObject = new MyDomainObject(1,2);
}
It is legal to write a method annotated with @EventHandler with a
return type of VOID or with a return type equal to the input type. In
case the return type is void, the processed event won't be put back in
the cache, in case the return type is equal to the input type, the
object will be written back in the cache.
I have therefore a method which I thought would have returned java
VOID and returns BoxedUnit. Is there a way I can investigate that?
Best Regards
Edmondo
2012/3/16 Daniel Sobral <dcso...@gmail.com>:
Best Regards
Edmondo
2012/3/16 Björn Antonsson <bjorn.a...@typesafe.com>:
> Hi Edmondo,
>
> I'm pasting your example into the REPL, and everything seems ok.
>
> scala> class MyEventDrivenClass {
> | def handler(event: String) {}
> | }
> defined class MyEventDrivenClass
> scala> :javap MyEventDrivenClass
> Compiled from "<console>"
> public class MyEventDrivenClass extends java.lang.Object implements
> scala.ScalaObject{
> public void handler(java.lang.String);
> public MyEventDrivenClass();
> }
>
> If that's really your whole class, then I've no clue to what's going on.
>
> /Björn
> --
> Björn Antonsson
> Typesafe - The software stack for applications that scale
Dear Bjorn,
I absolutely agree with you there is a problem inside my class, but I
don't know which one might be triggering that. Is it possible to
detect at "global level" where a BoxedUnit is generated happens, such
with a breakpoint, a decompilation, or something like that?
for every class annotated with @EventDriven the framework create an
object, which is the real EventHandlerImpl, through reflection.
I guess the object exploits generic, as you are saying, and probably
the reflection mechanism can't recognize that a method returning Unit
is a void, and therefore treat it like the others...
Does it sounds reasonable?
Best Regards
2012/3/16 √iktor Ҡlang <viktor...@gmail.com>:
That might be true, actually...at a framework level..
for every class annotated with @EventDriven the framework create an
object, which is the real EventHandlerImpl, through reflection.
I guess the object exploits generic, as you are saying, and probably
the reflection mechanism can't recognize that a method returning Unit
is a void, and therefore treat it like the others...
Does it sounds reasonable?