Using 2.3.0 akka-actor and 2.3.1 akka-actor, and checked with 1.7.0 and 1.8 
JVM:  

The following code generates a strange compile exception:

package akkastudy.supervisorstrategy.java;

import akka.actor.AllForOneStrategy;
import akka.actor.Props;
import akka.actor.SupervisorStrategy;
import akka.actor.UntypedActor;
import akka.japi.Function;
import scala.concurrent.duration.Duration;

import java.util.concurrent.TimeUnit;

import static akka.actor.SupervisorStrategy.*;

public class AllForOneGrandparentActor extends UntypedActor {

    @Override
    public SupervisorStrategy supervisorStrategy() {
        return new AllForOneStrategy(10, Duration.create(1, TimeUnit.HOURS),
                new Function<Throwable, SupervisorStrategy.Directive>() {
                    @Override
                    public SupervisorStrategy.Directive apply(Throwable 
param) throws Exception {
                        if (param instanceof IllegalArgumentException) 
return stop();
                        if (param instanceof ArithmeticException) return 
resume();
                        if (param instanceof NullPointerException) return 
restart();
                        else return escalate();
                    }
                }
        );
    }

    @Override
    public void onReceive(Object message) throws Exception {
        if (message instanceof Props) {
            Props props = (Props) message;
            getSender().tell(getContext().actorOf(props), self());
        } else unhandled(message);
    }
}

Where the exception is:

[info] Compiling 18 Scala sources and 15 Java sources to 
/home/danno/development/akka-study/target/scala-2.10/classes...
[error] 
/home/danno/development/akka-study/src/main/java/akkastudy/supervisorstrategy/java/OneForOneGrandparentActor.java:12:
 
error: cannot access 1
[error] import static akka.actor.SupervisorStrategy.*;
[error] ^
[error]   class file for akka.actor.SupervisorStrategy$1 not found
[error] 
/home/danno/development/akka-study/src/main/java/akkastudy/supervisorstrategy/java/OneForOneGrandparentActor.java:21:
 
error: cannot find symbol
[error]                         if (param instanceof 
IllegalArgumentException) return stop();
[error]                                                                     
          ^
[error]   symbol: method stop()
[error] 
/home/danno/development/akka-study/src/main/java/akkastudy/supervisorstrategy/java/OneForOneGrandparentActor.java:22:
 
error: cannot find symbol
[error]                         if (param instanceof ArithmeticException) 
return resume();
[error]                                                                     
     ^
[error]   symbol: method resume()
[error] 
/home/danno/development/akka-study/src/main/java/akkastudy/supervisorstrategy/java/OneForOneGrandparentActor.java:23:
 
error: cannot find symbol
[error]                         if (param instanceof NullPointerException) 
return restart();
[error]                                                                     
      ^
[error]   symbol: method restart()
[error] 
/home/danno/development/akka-study/src/main/java/akkastudy/supervisorstrategy/java/OneForOneGrandparentActor.java:24:
 
error: cannot find symbol
[error]                         else return escalate();
[error]                                     ^
[error]   symbol: method escalate()


The workaround would be to explicitly call SupervisorStrategy.resume() and 
SupervisorStrategy.stop(), etc. without the static import.  This had worked 
previously.

Does the problem occur elsewhere, like in the actual Scala and Java interop 
itself? or is this an Akka issue?

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to