Merge pull request #539 from akka/wip-2217-create-nonpublic-class-√

#2217 - setting accessible = true before newInstance
This commit is contained in:
viktorklang 2012-06-18 01:40:56 -07:00
commit 74e69c4ebd
3 changed files with 30 additions and 1 deletions

View file

@ -185,5 +185,10 @@ case class Props(
* able to optimize serialization.
*/
private[akka] case class FromClassCreator(clazz: Class[_ <: Actor]) extends Function0[Actor] {
def apply(): Actor = clazz.newInstance
def apply(): Actor = try clazz.newInstance catch {
case iae: IllegalAccessException
val ctor = clazz.getDeclaredConstructor()
ctor.setAccessible(true)
ctor.newInstance()
}
}