Add customized NPE for null actor system (#23580)

* Add customized NPE for null actor system

* "system must not be null!"
This commit is contained in:
Will Sargent 2017-09-04 07:31:43 -07:00 committed by Arnout Engelen
parent 1e4e7cbba2
commit b600c517a1

View file

@ -74,7 +74,9 @@ trait ExtensionId[T <: Extension] {
/**
* Returns an instance of the extension identified by this ExtensionId instance.
*/
def apply(system: ActorSystem): T = system.registerExtension(this)
def apply(system: ActorSystem): T = {
java.util.Objects.requireNonNull(system, "system must not be null!").registerExtension(this)
}
/**
* Returns an instance of the extension identified by this ExtensionId instance.