add Java API for most case objects

- “case object” will emit a concrete class without constructor, so put
  abstract class in its way in order to obtain an accessible type for
  Scala & Java (i.e. without $)
- add “def instance = this” to make access uniform from Java
- this does not work for nested case objects because of missing static
  forwarders, so keep those as they were
- fix issue with case object FromConfig colliding with case class
  FromConfig by open-coding the “case”iness in this case (should be
  thrown out in 2.1)
This commit is contained in:
Roland 2012-04-10 12:07:14 +02:00
parent 21f2c28fd1
commit b6db48818a
6 changed files with 99 additions and 18 deletions

View file

@ -1,7 +1,12 @@
package akka.actor;
import akka.actor.ActorSystem;
import akka.event.Logging;
import akka.event.Logging.LoggerInitialized;
import akka.japi.Creator;
import akka.routing.CurrentRoutees;
import akka.routing.FromConfig;
import akka.routing.NoRouter;
import akka.testkit.AkkaSpec;
import org.junit.AfterClass;
@ -23,6 +28,23 @@ public class JavaAPI {
system.shutdown();
system = null;
}
// compilation tests
@SuppressWarnings("unused")
public void mustCompile() {
final Kill kill = Kill.instance();
final PoisonPill pill = PoisonPill.instance();
final ReceiveTimeout t = ReceiveTimeout.instance();
final LocalScope ls = LocalScope.instance();
final NoScopeGiven noscope = NoScopeGiven.instance();
final LoggerInitialized x = Logging.loggerInitialized();
final CurrentRoutees r = CurrentRoutees.instance();
final NoRouter nr = NoRouter.instance();
final FromConfig fc = FromConfig.instance();
}
@Test
public void mustBeAbleToCreateActorRefFromClass() {