modify out of date note about java8 compat (#361)

* remove out of date note about java8 compat

* Update CONTRIBUTING.md

* extend notes for Java API contributors

* vice versa
This commit is contained in:
PJ Fanning 2023-05-29 17:42:35 +01:00 committed by GitHub
parent 6b90b20334
commit 5abffda7db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -533,10 +533,12 @@ Scala has proven the most viable way to do it, as long as you keep the following
1. If the underlying Scala code requires an `ExecutionContext`, make the Java API take an `Executor` and use
`ExecutionContext.fromExecutor(executor)` for conversion.
1. Make use of `scala-java8-compat` conversions, see [GitHub](https://github.com/scala/scala-java8-compat)
(eg. `scala.compat.java8.FutureConverters` to translate Futures to `CompletionStage`s).
Note that we cannot upgrade to a newer version scala-java8-compat because of binary compatibility issues.
1. Use `org.apache.pekko.util.FutureConverters` to translate `Future`s to `CompletionStage`s (or vice versa).
1. Use `org.apache.pekko.util.OptionConverters` to translate `Option`s to Java `Optional`s (or vice versa).
1. Use `org.apache.pekko.util.FunctionConverters` to translate Scala Functions to Java Functions (or vice versa).
1. Make sure there are Java tests or sample code touching all parts of the API
1. Do not use lower type bounds: `trait[T] { def method[U >: Something]: U }` as they do not work with Java