Skip to content

Release 0.2.0

Compare
Choose a tag to compare
@Maia-Everett Maia-Everett released this 19 May 17:10
· 31 commits to master since this release

API breaking release.

  • Moved Promise and PromiseFactory to root package org.lucidfox.jpromises to better present them as the core classes of the library.
  • Merged Resolver and Rejector into one interface, named Resolver.
    • There was really no reason to have two interfaces, other than the fact that JavaScript promises use two functions. Since Resolver is already not a functional interface (it has deferResolve), it makes sense to merge everything into it.
  • Convenience then overloads renamed to thenAccept and thenApply to make IDEs play nicer with lambda type inference, much like CompletableFuture does.
  • onException and onExceptionApply now restrict the type of the return value to the value type of the promise, and pass it unchanged if the promise was resolved rather than rejected.
  • Added convenience methods to PromiseFactory: promiseAsync, supplyAsync and runAsync, which use the specified executor to resolve a promise off the main thread without having to manually write glue code for it.
  • Added Resolver.getPromise, which provides access to the promise instance within the promise handler while it is being resolved. Corner case, but occasionally useful for tracking promise identity in collections.
  • GWT: JsPromise now uses JsResolver and JsPromiseHandler, so that getPromise can return the correct type for its construction.
  • Added AndroidPromiseFactory.