diff --git a/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java b/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java index 72eda74c70..5125611498 100644 --- a/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java +++ b/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java @@ -32,18 +32,18 @@ public class JavaAPI { // compilation tests @SuppressWarnings("unused") public void mustCompile() { - final Kill kill = Kill.instance(); - final PoisonPill pill = PoisonPill.instance(); - final ReceiveTimeout t = ReceiveTimeout.instance(); + final Kill kill = Kill.getInstance(); + final PoisonPill pill = PoisonPill.getInstance(); + final ReceiveTimeout t = ReceiveTimeout.getInstance(); - final LocalScope ls = LocalScope.instance(); - final NoScopeGiven noscope = NoScopeGiven.instance(); + final LocalScope ls = LocalScope.getInstance(); + final NoScopeGiven noscope = NoScopeGiven.getInstance(); final LoggerInitialized x = Logging.loggerInitialized(); - final CurrentRoutees r = CurrentRoutees.instance(); - final NoRouter nr = NoRouter.instance(); - final FromConfig fc = FromConfig.instance(); + final CurrentRoutees r = CurrentRoutees.getInstance(); + final NoRouter nr = NoRouter.getInstance(); + final FromConfig fc = FromConfig.getInstance(); } @Test diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index 373bedfc1e..8d34efeb59 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -30,19 +30,28 @@ case class Failed(cause: Throwable) extends AutoReceivedMessage with PossiblyHar abstract class PoisonPill extends AutoReceivedMessage with PossiblyHarmful case object PoisonPill extends PoisonPill { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } abstract class Kill extends AutoReceivedMessage with PossiblyHarmful case object Kill extends Kill { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } case class Terminated(@BeanProperty actor: ActorRef) extends PossiblyHarmful abstract class ReceiveTimeout extends PossiblyHarmful case object ReceiveTimeout extends ReceiveTimeout { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** diff --git a/akka-actor/src/main/scala/akka/actor/Deployer.scala b/akka-actor/src/main/scala/akka/actor/Deployer.scala index 17bdbec4b0..539a0126a6 100644 --- a/akka-actor/src/main/scala/akka/actor/Deployer.scala +++ b/akka-actor/src/main/scala/akka/actor/Deployer.scala @@ -71,7 +71,10 @@ case object LocalScope extends LocalScope { @deprecated("use instance() method instead", "2.0.1") def scope: Scope = this - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this def withFallback(other: Scope): Scope = this } @@ -84,7 +87,10 @@ abstract class NoScopeGiven extends Scope case object NoScopeGiven extends NoScopeGiven { def withFallback(other: Scope): Scope = other - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** diff --git a/akka-actor/src/main/scala/akka/event/Logging.scala b/akka-actor/src/main/scala/akka/event/Logging.scala index 4bc3bf6b41..970da67546 100644 --- a/akka-actor/src/main/scala/akka/event/Logging.scala +++ b/akka-actor/src/main/scala/akka/event/Logging.scala @@ -590,7 +590,10 @@ object Logging { */ abstract class LoggerInitialized case object LoggerInitialized extends LoggerInitialized { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** diff --git a/akka-actor/src/main/scala/akka/routing/Routing.scala b/akka-actor/src/main/scala/akka/routing/Routing.scala index 3650779609..fdf14a5b96 100644 --- a/akka-actor/src/main/scala/akka/routing/Routing.scala +++ b/akka-actor/src/main/scala/akka/routing/Routing.scala @@ -346,7 +346,10 @@ case class Broadcast(message: Any) */ abstract class CurrentRoutees case object CurrentRoutees extends CurrentRoutees { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** @@ -376,16 +379,22 @@ case object NoRouter extends NoRouter { def supervisorStrategy = null override def withFallback(other: RouterConfig): RouterConfig = other - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** * Router configuration which has no default, i.e. external configuration is required. */ case object FromConfig extends FromConfig { - def instance = this - def apply(routerDispatcher: String = Dispatchers.DefaultDispatcherId) = new FromConfig(routerDispatcher) - def unapply(fc: FromConfig): Option[String] = Some(fc.routerDispatcher) + /** + * Java API: get the singleton instance + */ + def getInstance = this + @inline final def apply(routerDispatcher: String = Dispatchers.DefaultDispatcherId) = new FromConfig(routerDispatcher) + @inline final def unapply(fc: FromConfig): Option[String] = Some(fc.routerDispatcher) } /** @@ -411,21 +420,28 @@ class FromConfig(val routerDispatcher: String = Dispatchers.DefaultDispatcherId) // open-coded case class to preserve binary compatibility, all deprecated for 2.1 @deprecated("FromConfig does not make sense as case class", "2.0.1") override def productPrefix = "FromConfig" + @deprecated("FromConfig does not make sense as case class", "2.0.1") def productArity = 1 + @deprecated("FromConfig does not make sense as case class", "2.0.1") def productElement(x: Int) = x match { case 0 ⇒ routerDispatcher case _ ⇒ throw new IndexOutOfBoundsException(x.toString) } + @deprecated("FromConfig does not make sense as case class", "2.0.1") def copy(d: String = Dispatchers.DefaultDispatcherId): FromConfig = new FromConfig(d) + @deprecated("FromConfig does not make sense as case class", "2.0.1") def canEqual(o: Any) = o.isInstanceOf[FromConfig] + @deprecated("FromConfig does not make sense as case class", "2.0.1") override def hashCode = ScalaRunTime._hashCode(this) + @deprecated("FromConfig does not make sense as case class", "2.0.1") override def toString = "FromConfig(" + routerDispatcher + ")" + @deprecated("FromConfig does not make sense as case class", "2.0.1") override def equals(other: Any): Boolean = other match { case FromConfig(x) ⇒ x == routerDispatcher diff --git a/akka-zeromq/src/main/scala/akka/zeromq/Response.scala b/akka-zeromq/src/main/scala/akka/zeromq/Response.scala index 2729e582b3..6b3f3e5eb6 100644 --- a/akka-zeromq/src/main/scala/akka/zeromq/Response.scala +++ b/akka-zeromq/src/main/scala/akka/zeromq/Response.scala @@ -12,11 +12,17 @@ sealed trait Response * When the ZeroMQ socket connects it sends this message to a listener */ case object Connecting extends Response { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this } /** * When the ZeroMQ socket disconnects it sends this message to a listener */ case object Closed extends Response { - def instance = this + /** + * Java API: get the singleton instance + */ + def getInstance = this }