=act #17239 Add akka.japi.function with variance
Needed by Akka Streams. Old functions placed in akka.japi will be deprecated in 2.4 (cherry picked from commit 99628f408295070848af6c23b1d722057069e660) +act #17392 Include generated japi.function from akka-stream * add boilerplate plugin * make them Serializable to be able to grab line number for Java 8 lambdas (cherry picked from commit d5950a13d2f123d2101d56f0a8a86a2097dda8e1)
This commit is contained in:
parent
db5a32fa04
commit
412491d277
4 changed files with 101 additions and 1 deletions
|
|
@ -14,3 +14,6 @@ OSGi.actor
|
|||
libraryDependencies ++= Dependencies.actor
|
||||
|
||||
MimaKeys.previousArtifact := akkaPreviousArtifact("akka-actor").value
|
||||
|
||||
spray.boilerplate.BoilerplatePlugin.Boilerplate.settings
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.japi.function
|
||||
|
||||
[3..22#/**
|
||||
* A Function interface. Used to create 1-arg first-class-functions is Java.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(##1L)
|
||||
trait Function1[[#-T1#], +R] extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply([#arg1: T1#]): R
|
||||
}#
|
||||
|
||||
]
|
||||
|
||||
[2..#/**
|
||||
* A Consumer interface. Used to create 1-arg consumers in Java.
|
||||
* A Procedure is like a Function, but it doesn't produce a return value.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(##1L)
|
||||
trait Procedure1[[#-T1#]] extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply([#arg1: T1#]): Unit
|
||||
}#
|
||||
|
||||
]
|
||||
66
akka-actor/src/main/scala/akka/japi/function/Function.scala
Normal file
66
akka-actor/src/main/scala/akka/japi/function/Function.scala
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.japi.function
|
||||
|
||||
/**
|
||||
* A Function interface. Used to create first-class-functions is Java.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Function[-T, +R] extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply(param: T): R
|
||||
}
|
||||
|
||||
/**
|
||||
* A Function interface. Used to create 2-arg first-class-functions is Java.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Function2[-T1, -T2, +R] extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply(arg1: T1, arg2: T2): R
|
||||
}
|
||||
|
||||
/**
|
||||
* A Procedure is like a Function, but it doesn't produce a return value.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Procedure[-T] extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply(param: T): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* An executable piece of code that takes no parameters and doesn't return any value.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Effect extends java.io.Serializable {
|
||||
@throws(classOf[Exception])
|
||||
def apply(): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Java API: Defines a criteria and determines whether the parameter meets this criteria.
|
||||
* `Serializable` is needed to be able to grab line number for Java 8 lambdas.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Predicate[-T] extends java.io.Serializable {
|
||||
def test(param: T): Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor/factory, takes no parameters but creates a new value of type T every call.
|
||||
*/
|
||||
@SerialVersionUID(1L)
|
||||
trait Creator[+T] extends Serializable {
|
||||
/**
|
||||
* This method must return a different instance upon every call.
|
||||
*/
|
||||
@throws(classOf[Exception])
|
||||
def create(): T
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
resolvers += Classpaths.typesafeResolver
|
||||
|
||||
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
|
||||
|
||||
// need this to resolve http://jcenter.bintray.com/org/jenkins-ci/jenkins/1.26/
|
||||
// which is used by plugin "org.kohsuke" % "github-api" % "1.68"
|
||||
resolvers += Resolver.jcenterRepo
|
||||
|
|
@ -38,3 +37,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1")
|
|||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
|
||||
|
||||
libraryDependencies += "org.kohsuke" % "github-api" % "1.68"
|
||||
|
||||
addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.5.9")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue