+act #3873 Adding Props.create method with manifested type

The generated classes for Java 8 lambdas doesn't carry the type information that we need, so we need to pass in the return type of the Creator.
This commit is contained in:
Björn Antonsson 2014-02-13 16:16:18 +01:00
parent f1edf78979
commit c432b3e2f0
3 changed files with 59 additions and 9 deletions

View file

@ -57,12 +57,27 @@ public class JavaAPI {
});
}
@SuppressWarnings("unchecked")
public static Props mkErasedProps() {
return Props.create(JavaAPITestActor.class, new Creator() {
public Object create() {
return new JavaAPITestActor();
}
});
}
@Test
public void mustBeAbleToCreateActorRefFromFactory() {
ActorRef ref = system.actorOf(mkProps());
assertNotNull(ref);
}
@Test
public void mustBeAbleToCreateActorRefFromErasedFactory() {
ActorRef ref = system.actorOf(mkErasedProps());
assertNotNull(ref);
}
@Test
public void mustBeAbleToCreateActorWIthConstructorParams() {
ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, "a", "b", new Integer(17), 18));