v0.6.0 (6 December 2026)

v0.6.0 on GitHub

New in 0.6.0

Compile-time

A step of the wrong kind of Path no longer compiles

Path.<AppError, String>right(userId).via(id -> Path.maybe(findUser(id)));

A MaybePath step in an EitherPath chain: javac says MaybePath<A> conforms to a Chainable of the chain's own Path, and the checker names the fix.

Concurrency

Ref and Promise share state between tasks

Each read and write is a VTask, so tasks running at once update one value without a lock, and memoize() runs a task once for every branch that needs it.

Spring

An error type states its own HTTP status

@ErrorStatus(409) on the variant replaces a class-name table or a naming rule.

Type safety

Instances lookups are checked by javac

Instances.monadZero(either()) threw ClassCastException when it ran. Now it does not compile.

Build speed

Builds with mappings stay incremental

A change beside @GenerateMapping, @GenerateMerge or @HkjHttpClient no longer recompiles the whole source set.

Cancellation

A timeout stops the task it timed out

VTask.timeout interrupts the task and waits for it to stop, so a retried timeout leaves no attempt running.

Stack safety

Deep programs run flat

Long Free, State, Coyoneda and FreeAp programs run without overflowing the stack, into the targets the chapter lists.

At a glance

  • javac checks what each step of a Path chain returns. A step of another kind of Path, or one that fails with an error the chain does not carry, is a compile error in the IDE as well as the build.
  • javac checks each capability Instances looks up. Instances.monadZero(either()), which threw ClassCastException when it ran, is a compile error, as is a MonadError declared with an error type its instance does not have.
  • A VStream recovers from a failure at any element, and a terminal operation stops at an interrupt.
  • Long Free, State, Coyoneda and FreeAp programs run without overflowing the stack, into the targets their chapters list.
  • Builds with mappings stay incremental, so a change beside @GenerateMapping no longer recompiles the whole source set.
  • Ref and Promise let VTasks share state, and memoize() runs a task once and shares its result with every branch that needs it.
  • A timeout cancels the task it timed out, as a Scope's timeout does, so a retried timeout leaves no attempt running.
  • An error type states its own HTTP status: @ErrorStatus(409) on the variant, where the status used to hide in a class-name table or a naming rule.

Mapping

  • More bean fix lines compile once followed (#1149, #1293). The setter offered for eMails is seteMails, a primitive word such as setx(int) is offered its wrapper, and no marker is offered under a name already taken. See When an unpaired accessor is refused and A method that only starts like an accessor.
  • An IdentityHashMap keeps every entry through a mapping or an optic (#1483, #1458). Both rebuilt it as a LinkedHashMap, merging keys that were equal but not the same object. It now comes back an IdentityHashMap. See Same-typed containers cross as copies and The forMapValues() Traversal.
  • A sparse update applied to several records gives each its own arrays (#1542). The results shared the one copy updateFrom made of an array. Each apply now copies an array again, and an IdentityHashMap too, at any depth and through a JsonNullable. What a leaf or a nested spec parsed is still shared. See Same-typed containers cross as copies.
  • A nullness checker can check a generated mapping (#1431, #1504, #1505, #1511, #1525). Its copies, guards, caches, JsonNullable reads and protobuf-java writes took or held an undeclared null, or lost the nullness inside a List<@Nullable String> or a passed-through key, so NullAway failed. With JSpecifyJDKModels, a parsing Optional failed too. Each now says so. See Same-typed containers cross as copies.
  • A leaf lifted over an array whose elements may be null compiles (#1511). The generated array constructor carried the element's annotation, as @Nullable String[]::new. javac refused it where the element is a nested class, and Error Prone crashed on it otherwise, in parse and build alike. It now names the array alone. See What lifts, and what does not.
  • The processor catches a @Nullable value build or a plain merge cannot hand on (#1431, #1503, #1525, #1635, #1639, #1638, #1675). build copied a null, or one inside it, into a site declared to hold none. A leaf, @Singular method or protobuf-java setter threw on one. Hold a nullable component as an Optional, or give both one nullness. See Nulls.
  • A record mapping offers no optic that would hand the domain a null it rules out (#1501, #1515, #1525, #1635). Where the wire or its own accessor declares @Nullable what the domain declares non-null, the optics let in what parse refuses. A full mapping has no asIso(); a projection maps as patch. See Where a @Nullable record component lands.
  • parse reports a map's null key, and one inside a key, beside every other failure (#1515, #1525). A generated parse, patch, updateFrom or fallible merge, and parseValues, parseKeys and parseEntries, threw NullPointerException at a null key; each now reports must not contain a null key. A generated one, which accepted a null inside a passed-through key, now reports it. See The null contract, precisely.

Optics

  • A Focus path's untyped shortcuts are gone, and a navigator takes their names (#1679). The no-argument each(), some(), head(), last() and the others, with at(index), atKey(key) and traverseOver, compiled on any focus. Typed forms read the element from the path. A field named like one, such as last, now gets a navigator. See A field named like a path method.
  • @ThroughField auto-detects a field whose getter the source inherits (#1637). Auto-detection looked only at getters the source declared itself, spelt after the field, so a spec whose lens read an inherited getter, or one the lens named, was refused as a field not found. It now finds the getter the lens calls. See @ThroughField Auto-Detection.
  • A class can declare several @GenerateIsos methods (#1601). A second one failed the build. Each method is now a field of one class named after the class declaring it, such as ConvertersIsos, in the package its targetPackage names. See Isos.
  • Generated optics handle a type-use annotation they cannot copy as written (#1583, #1571, #1594, #1605). One deprecated only by a javadoc tag, one setting a deprecated member and one that no longer matches its type are left off. A generator plugin gets the same by implementing the generateModifyF form that takes a GenerationContext. See Build-time impact and The TraversableGenerator Interface.
  • Optics over a null @Nullable container find no elements (#1633). A generated traversal or fold threw NullPointerException there. A @Nullable also counts beside an accessor the record declares itself, so the field's Focus method gives an AffinePath. See Nullable Components and Where a @Nullable counts.
  • Traversals over commons-collections4's HashMultiSet and TreeMultiSet (#1379, #1587). A component of either type now gets a traversal. A TreeMultiSet is rebuilt with the source's comparator, so a custom order is kept. See Apache Commons Collections.
  • @ImportOptics pairs a JavaBeans-spelt wither with its getter (#1148). A witheMail(String) beside geteMail(), as Lombok's beanspec capitalisation writes them, gives an eMail() lens, as withEMail beside getEMail() does. The processor says why it refuses a class whose only wither is with2D(int). See Wither Classes to Lenses.
  • A spec lens reads a getter inherited from two interfaces as javac does (#1136). An abstract source that inherits String name() from one interface and CharSequence name() from another is now read as returning String, so a Lens<Src, String> over it builds. A @ViaBuilder chain reads an inherited toBuilder() or build() the same way. See Compiler Messages.
  • Optics compile beside another method named after an accessor (#1292). A null-safe static String name(Person p) made the generated Person::name ambiguous, so the lens, Focus path or navigator, getter, setter or @ImportOptics lens did not compile. A widened Focus path failed beside any other method of its field's name, such as items(int index) beside List<String> items. See Path widening.
  • Generated code copes with more unusual names and types (#1643). A component or leaf named yield compiles, @GenerateFocus takes a $ in a component or type name, and a widened Focus path over a nullable type variable passes NullAway. See Path widening.
  • A generator plugin's optic expression can name a class more than once (#1632). Only the first occurrence was written as an import, so a later bare one could mean another type of the same name, such as a record named TreePSet. Every occurrence is now written the same way. See The TraversableGenerator Interface.
  • @GenerateFocus messages offer fixes that work when followed (#1272, #1283). A message that offers a navigator asks first for any rename it needs. An unknown field-list name is offered only a field the list can use, and a name written twice warns. See Two fields with one navigator name and Compiler Messages.
  • OpticOpFunctor.map applies its function (#1154). It returned the instruction unchanged, so code that mapped a lifted OpticOp failed later with ClassCastException. Each OpticOp record now carries a continuation k, as an @EffectAlgebra operation does, and an interpreter hands each result to op.k() in place of wrapping it in Free.pure. See What an interpreter actually is.
  • Generated optics over a sorted collection keep its comparator (#1430). Traversals and Focus paths over PSortedSet, PSortedMap and the Eclipse sorted sets rebuild with the source's comparator, so a custom order is kept. The …Rebuilding factories on Traversals and EachInstances do the same for your own optics, and getOrderedTypeArgumentIndex() for your own generators. See Sorted Variants and Comparators.
  • StreamTraversal.toTraversal() works over a VStream (#1442). On forVStream(), or a composition built on it, the result read its source twice, so a fromIterator source came out empty, and threw NoSuchElementException when read again. It now reads the source once, and gives a stream that replays the results. See Converting to a Traversal.
  • A nullness checker accepts more calls that were already safe (#1511, #1488, #1433). ValidatedPrism's bulk parses take a container that may hold a null. AffinePath.ofNullable, OptionalContext.io and JavaOptionalContext.io take a function that never returns one. fold on Either, Try and others takes a @Nullable result type. See The bulk forms and Values, never null.
  • A warning suppressed on an @ImportOptics lens stays quiet in an incremental build (#855). Gradle reads an unchanged spec from its class file, which keeps no @SuppressWarnings, so shorter-constructor and dropped-result came back and failed a -Werror build. The processor no longer repeats a warning about a declaration read from a class file. See Incremental compilation.

Effect Paths

  • javac checks each chain step's kind of Path and error type (#1314). A step passed to via or another chaining method must be the chain's own kind of Path, so a mismatch is a compile error rather than an exception at run time. A step may still fail with a variant of the chain's error. See The Family Parameter.
  • javac checks each Effect Context step, as it does a Path's (#1567). A via step of another kind, or with another error, configuration or state type, compiled and could throw a ClassCastException later. Chaining methods also take an ErrorContext step failing with a variant of its error, or a ConfigContext step reading less configuration. See What a Step May Return.
  • ConfigContext.contramap takes a function that reads a supertype or returns a subtype (#1576). It takes Function<? super R2, ? extends R>, as ReaderPath.local does, so a function held in a variable no longer has to name both configuration types exactly.
  • EitherPath gains ensure (#1338): ensure(test, onFail) keeps a success whose value passes test and turns any other success into a failure built from its value, so a guard no longer needs an if returning a Left. See EitherPath.
  • A RECOVERABLE @PathSource Path takes its MonadError once (#1007). of(kind, monadError) and pure(value, monadError) take the one instance, which composes the Path and recovers it. The forms that also take the Monad are deprecated for removal in 0.7.0, and the MigrateDeprecationsTo0_7_0 recipe drops the repeated argument. See Recovery with errorType and Deprecated for removal in 0.7.0.
  • TrampolinePath and FreePath combine three paths with zipWith3 (#1302): both already combined two paths with zipWith. The three-way combine stays lazy until run() or foldMap, so a deep chain stays stack-safe. See Combinable (Applicative).
  • NonDetPath and StreamPath catch up with ListPath (#1337, #1322, #1152). NonDetPath gains lastOption, anyMatch, allMatch, takeWhile, dropWhile, get, foldRight, fold and foldMap. ListPath, StreamPath and NonDetPath each convert to the other two. See the Effect Path Cheatsheet.
  • Monoid.of builds a monoid from its empty value and its operation, and Monoids.bigDecimalAddition() sums money exactly (#1356). Monoid.of(Duration.ZERO, Duration::plus) takes the place of an anonymous class, and an existing Semigroup can be the operation. See Semigroup and Monoid.
  • Monoids.list(), Monoids.set(), and Monoids.string() now run in linear time in combineAll (#1692).
  • Either and Maybe gain more conversions (#1405, #1406, #1407, #1404). Maybe.fromEither and Either.fromOptional convert into each type. Either also gains toOptional, swap, orElse and orElseGet. See Reading an Either.
  • A successful narrow allocates nothing (#1350). narrow, narrowWithTypeCheck and narrowHolder built the context for their error message before checking anything. They now build it only when a check fails. See What each step allocates.
  • Each Lazy in a flatMap chain works out its value once (#1608, #1611). Each step now caches its value, or any failure but running out of memory or stack, once the chain reaches it. A step two threads reach at once runs on one, and the other waits. See Working it out once and When the work fails.
  • Ref and Promise let tasks running at the same time share state, and memoize() runs a task once for them all (#550). Each read and write of a Ref is a VTask, and a Promise is completed once and read by tasks that wait for it. memoize() shares one result between runs, and caches no failure. See Shared State.
  • VResultPath and VTaskContext gain memoize() (#1663). Both give a fresh cache on each run of the outer effect. A memoised VResultPath keeps a Left as a computed value and can try again after a thrown exception. See Shared State.
  • VResultPath runs in one call with unsafeRun() and runAsync(), as VTaskPath does (#803). unsafeRun() returns the Either that run().run() gave, and runAsync() starts the task on a virtual thread and returns a future of it. A typed failure still arrives as a Left, and only an exception the task throws escapes.
  • Maybe, Try and their Paths gain fold, and Try and Validated gain toOptional (#546, #1490, #1509). Maybe, MaybePath and OptionalPath take the empty case first, and Try and TryPath the failure first. foldFailureFirst is deprecated for removal in 0.7.0. See Reading a Try and Deprecated for removal in 0.7.0.
  • ListPath and NonDetPath name the null they refuse (#1438). A null element, or a map, zipWith or zipWith3 function that returns null, threw a NullPointerException with no message. The message now says which, as StreamPath's does.
  • A Selective of your own runs only the branch its condition picks (#1358). The default whenS ran its effect for a false condition, and the default ifS ran both branches. Both now leave the choice to select: one that keeps its contract skips what the condition does not pick, and one built from ap still runs every effect. See Selective.
  • mapError on MaybePath, TryPath and CompletableFuturePath carries the mapped error (#1332): recover after it sees that error, where it used to see the old one. A success is a Right and the mapper is not called. MaybePath and TryPath return an EitherPath. CompletableFuturePath returns a VResultPath. See Recoverable (MonadError).
  • toEitherPath, toMaybePath and toTryPath follow recover on a failed CompletableFuturePath (#1354). A cancelled future gives Left of its CancellationException, or Nothing, instead of throwing. toTryPath holds the exception the future failed with, not a CompletionException around it.
  • A half-open CircuitBreaker admits a call only while running and successful probes are fewer than successThreshold (#1481); it admitted every call. Any other call gets a CircuitOpenException, as when the circuit is open. A call now counts only towards the state it was admitted in, so a success from before an outage cannot close the circuit. See Circuit Breaker.
  • Each attempt at a call that one CircuitBreaker guards twice counts once, at the guard nearest the dependency (#1482). A repository and the service that calls it, each guarding one dependency with one breaker, counted every outcome twice. The inner guard now counts each attempt, and an open circuit turns a retry's later attempts away. See The State Machine.
  • A retry round a circuit breaker stops once the circuit opens, as the docs say (#1506). ResilienceBuilder, Resilience.withCircuitBreakerAndRetry and Resilience.protect retried a CircuitOpenException, so each remaining attempt waited out its backoff, was turned away, and the call ended in RetryExhaustedException. They now decline it whatever the policy says, and the caller gets the CircuitOpenException. See The Ordering Problem.
  • A call that one Bulkhead guards twice takes one permit (#1502). A repository and the service that calls it, each guarding one dependency with one bulkhead, took two, so with maxConcurrent(1) the call waited waitTimeout and failed. The inner guard now runs on the call's permit, on its thread or under a timeout. See One Call, One Permit.
  • A VStream recovers from a failure at any element (#1029). recoverWith, mapError and onError acted on the first pull only. A recover after a failed mapTask now carries on through the operators between them, even where one exception instance fails several elements. See When an element fails.
  • The chunking and parallel operators keep their results around a failure (#1029, #1437). chunk, chunkWhile, mapChunked and the parEvalMap operators hand on what they read first. A recover after a parEvalMap operator carries on past a failed task. VStream.closeAfterFailure is deprecated for removal in 0.7.0. See When a task fails and Deprecated for removal in 0.7.0.
  • parEvalFlatMap closes the streams it built but never reached (#1454). When a take or headOption stopped inside one of a batch's streams, or a failure or an interrupt ended the stream, the rest of the batch's streams were dropped unclosed, and their finalisers never ran. Closing the stream now closes them.
  • A VStream fails with the exception its task threw (#1410). A checked one, such as an IOException from mapTask, a finaliser or a publisher, reached every terminal operation inside a VTaskExecutionException, or a RuntimeException from parEvalMap, parEvalMapUnordered and merge. run(), and the conversions that call it such as toListPath(), still wrap it.
  • Par, Scope and VStreamPar fail with the task's own Throwable (#1418). A Throwable that is neither an Exception nor an Error reached the caller inside a RuntimeException once the task was forked, though the task run on its own failed with it. VTask.asCallable() now throws it unchanged.
  • ScopeJoiner.resultEither() is removed (#1680). It read the result of whichever Joiner was handed out last, so another scope could change what it saw, and each ScopeJoiner kept that scope's results for as long as it lived. joinEither() on the Scope gives the scope's own result as an Either. See Holding the result as a value.
  • Instances.alternative(vstream()) gives VStream's Alternative (#1425). It failed with a ClassCastException, because the vstream() token held a plain monad, so code had to name VStreamAlternative.INSTANCE. Instances.monad(vstream()) now returns that same object, which behaves as the monad did.
  • The compiler checks Instances.monadError, monadZero and alternative (#1321). A lookup for a capability the type's instance lacks, such as Instances.monadZero(either()), compiled and threw ClassCastException when it ran. It no longer compiles, and nor does a MonadError declared with an error type its instance does not have. See What the compiler checks.
  • VStreamPar.parEvalMapUnordered emits each result as its task completes (#1419). It waited for each batch's slowest task, then emitted the batch in input order. Now a slow task holds back only its own result. Its running tasks and waiting results are never more than concurrency together, so a slow consumer slows the reading. VStreamPath's does the same.
  • VStreamPar.parCollect is deprecated for removal in 0.7.0 (#1427), with VStreamPath.parCollect and PathOps.parCollectVStream. A stream is read one pull at a time, so they run nothing in parallel and give the list toList() gives. Put work you want run in parallel in parEvalMap's function, then call toList(). The MigrateDeprecationsTo0_7_0 recipe rewrites each call. See Deprecated for removal in 0.7.0.
  • A VTaskPath hands every handler the exception its task threw (#1396). A checked one, such as an IOException, reached runSafe, catching and toTryPath, and any step after via, then or guarantee, wrapped in a VTaskExecutionException, so a retry on IOException gave up at once. Only unsafeRun(), which cannot throw one, still wraps it. See VTaskPath.
  • Context.recoverWith recovers from a failure in an earlier map or flatMap function (#1443). An exception thrown by the function, or a function that returned null, escaped a recoverWith later in the chain, though recover and mapError caught it. A recovery function that fails now hands its failure to the next recoverWith out.
  • A timeout cancels the task it timed out, as a Scope's timeout does (#1372). When the time runs out, VTask.timeout interrupts the task and fails once it has stopped, so a retry over a timeout leaves no attempt running. Every withTimeout but CompletableFuturePath's builds on it, as do ResilienceBuilder and the circuit breaker's callTimeout. See VTaskPath.
  • detachOnCancel() lets a timeout fail on time over work that cannot stop at once (#1372). The work is still interrupted, but nothing waits for it, so a call blocked where an interrupt cannot reach it still fails at the deadline, and a circuit breaker can open. It is on VTask, IOPath, VTaskPath, VResultPath and VTaskContext. See Timeouts.
  • A fromPublisher stream can be read again, and asks only for what it can hold (#1442). It subscribed once, when built, so a second read waited for ever, and asked for more as each element arrived, however full its buffer. Each run now subscribes at its first pull, and asks for one more per element taken. See Publisher to VStream.
  • Long State, Free, Coyoneda and FreeAp programs no longer overflow the stack (#1448, #1460, #1470). Free.foldMap runs a deep program into Id, Either or Writer, though a List step with several results still adds to the stack. A FreeAp interpreter is also handed the instructions in the order written. See State, Free Monad, Coyoneda and Free Applicative.
  • Natural is the library's one natural-transformation type (#1455). GenericPath.mapK takes a Natural, and VStreamTransformations gives Naturals. The effect package's NaturalTransformation now extends Natural, and is deprecated for removal in 0.7.0 with FreePath.foldMapWith and FreeApPath.foldMapWith. The MigrateDeprecationsTo0_7_0 recipe rewrites each use. See Deprecated for removal in 0.7.0.
  • WriterPath.listen() reads the log, as MonadWriter.listen does, and tell(log) appends to it (#1450). listen() pairs the value with the log, and leaves the log as it is. listen(log), which appended, is deprecated for removal in 0.7.0, and the MigrateDeprecationsTo0_7_0 recipe renames each call to tell(log). See Writer and Deprecated for removal in 0.7.0.
  • A VStream terminal operation stops at an interrupt (#1428). toList, fold, drain and the others did not check between pulls, so neither a timeout nor a cancelled Scope could stop a stream whose pulls never block. Each now fails with an InterruptedException and closes what it has read, so the finalisers there run. See Running a stream.
  • Stopping one run of a shared VStream leaves its other runs alone (#1461). A take(0), a failed first pull or a close() on a stream another thread was reading released that thread's bracket resource, ran its onFinalize finaliser, or stopped its merge, fromPublisher or parEvalMapUnordered. Each run now closes only what it opened. See bracket opens and closes.
  • VStream.fromStream closes the Java Stream it reads (#1029). It read the stream through its iterator and never closed it, so its onClose handlers never ran, and a Files.lines file stayed open. The VStream now closes it when a run that has pulled it ends, fails or stops early. See A file, a line at a time.
  • Free.foldMap keeps what each step's value holds besides its result (#1460). For a target that runs each step at once, such as Writer or List, it kept only the result. A Writer or WriterT<Id, ...> lost its log, a List its other elements and an EitherOrBoth its warnings. Each value now reaches the target whole. See Free Monad.
  • A Free program over instructions with no Functor of their own can now be run, through Coyoneda (#1470). Coyoneda.foldMap(natural, functor) runs a held value through an interpreter, and Coyoneda.interpreter(natural, functor) gives the interpreter that a FreePath needs when its Functor is CoyonedaFunctor. See Coyoneda.
  • Every Path's getOrElseGet refuses a supplier that returns null (#1489). On MaybePath, EitherPath, ValidationPath, EitherOrBothPath and OptionalPath, and in Maybe.orElseGet, a null from the supplier was handed back, though the result type is non-null. It now throws NullPointerException, as TryPath.getOrElseGet and Either.orElseGet already did.
  • Stop a runAsync() task by cancelling its future (#1412). cancel(true) on the future from runAsync() on VTask, VTaskPath, VResultPath, VTaskContext or VStream, or from EffectBoundary.runAsync, interrupts the task, as a future from an ExecutorService does, and cancel(false) leaves it running. See Running a task.
  • @GeneratePathBridge reads an inherited method whose type parameter is bounded by interfaces alone (#1552). A bound such as <R extends Comparable<T> & Serializable>, on a method inherited from a generic interface, stopped the build with an IndexOutOfBoundsException from the processor.
  • A Path's type-mismatch message names the method and both Path types (#401, #1559). Every built-in Path words it as MaybePath did, and generated @PathSource Paths use the same wording for zipWith. The message points to conversion methods and Path factories. See A step that returns the wrong kind of Path.

Spring

  • An @HkjHttpClient interface can extend a generic base interface (#858). A client such as UserCrudApi extends CrudApi<ApiError, UserDto, String> failed to build, naming a type variable it never declared. The processor now generates it as if it redeclared each inherited method with those type arguments in place of the base's type variables. See Generic Clients.
  • Unit works over HTTP where Void did (#1522, #1536). A Unit inside a JSON body writes null, and an @HkjHttpClient method with a Unit error type reads no error body. A Void error type on such a client is now a compile error that names Unit. See Nested values and Decoding Errors.
  • A VTaskPath response timeout interrupts its task (#1412). When hkj.virtual-threads.default-timeout-ms runs out, the starter answers 504 and interrupts the task, without waiting for it to stop. The task used to run on after the response had gone. See VTaskPath.
  • An @HkjHttpClient interface takes a type-level @HttpExchange from its base (#1561). A client with none of its own sent its requests without the base's URL prefix, media types, headers and version, and nothing warned of it. It now takes the base's, as a Spring HTTP interface does. See Generic Clients.
  • A base's annotations no longer break an @HkjHttpClient build inside generated code (#1571). The processor names a base's annotation the client cannot copy, leaves off one Spring never reads, and suppresses a deprecated one's warning. See Generic Clients.
  • An @HkjHttpClient accepts a diamond whose declarations differ only in @SuppressWarnings (#1618). Two bases declaring one method were refused beside the client but accepted from a jar. A @SuppressWarnings on a method or a parameter no longer counts in the comparison, and the native method does not copy it. See Generic Clients.
  • A client inheriting a bare @PathVariable from a base compiled without -parameters is refused (#855). The base's class file names the parameter arg0, so the client bound arg0 and the request failed at run time. The processor now says cannot name the binding of. Compile the base with -parameters, name the binding, or redeclare the method. See Declarative HTTP Clients.
  • The starter depends on spring-boot-starter-webmvc (#1377). Spring Boot 4 deprecates spring-boot-starter-web, which the starter put on every application's classpath. The new starter brings the same modules, so nothing changes at runtime.
  • An error type states its own HTTP status (#799). Put @ErrorStatus(409) on a variant, implement HttpStatusCarrier, or give an ErrorStatusResolver bean for a type you cannot annotate. A shared API module can use the first two through the new hkj-spring-boot-http, which depends on nothing from Spring. Its HttpHeaderCarrier replaces the deprecated one in web.returnvalue. See Error Status Mapping.

Build and tooling

  • discarded-effect flags a dropped VTask (#1662). Calls like ref.set(7);, ref.update(f); and promise.complete(v); build a task whose work waits until it runs. See Compile-Time Checks.
  • Generated code over deprecated types compiles under -Werror (#1375, #1381, #1591, #1583, #1590). Mappings, merges, optics and @HkjHttpClient clients suppress deprecation or removal on the generated code that needs it. A client also does so for varargs and raw-typed signatures. See Build-time impact and What Gets Generated.
  • Annotations may name a constant another processor writes (#1597, #1614, #1571, #1584). Mapping, optics, effect and @HkjHttpClient annotations set to one failed the build or read the wrong value. So did @Deprecated(forRemoval = ...) and @SuppressWarnings beside them. The processors now cope with a constant that does not exist yet. See Mapping over types other processors generate and Generic Clients.
  • Optics, effects and clients wait for a type another processor writes (#1598, #1623, #1625, #1622, #1571, #1584, #1626). Naming one could break the build or drop code. Incremental builds now match clean ones for @PathSource, and @Handles messages name operations correctly. See Optics over types other processors generate and Effect annotations naming what other processors generate.
  • The HKJ checker names the fix beside javac's error for a mismatched step (#1314, #1568, #1678). error-type-mismatch says where to type the chain or map the step's error. path-type-mismatch reads method references, VResultPath and the accumulating methods, names a conversion only where one exists, and reads a DefaultVStreamPath as the VStreamPath it implements. See Compile-Time Checks.
  • A build with an HKJ plugin applied can set the checker's options (#1336, #1346). A hand-written -Xplugin:HKJChecker severity=warn failed the build with plug-in not found: HKJChecker. The Gradle and Maven plugins now add no checker argument of their own when the build names the checker, and the Gradle plugin finds the build's argument wherever it is added. See Configuring the checker.
  • A build with the HKJ Gradle plugin can turn on Gradle's configuration cache (#1374). With the cache on, hkjInstallSkills and hkjDiagnostics failed, and so did every build with skills = true, which runs hkjInstallSkills. Both tasks now run with it, and the next build reuses the cache. See With the Plugin.
  • Installed Claude Code skills say which release they describe, and a build keeps one copy (#1373). Each install writes only what changed, and .claude/skills/.hkj-skills-version. A build says when the stamp names another release, or is missing, as on every earlier copy. Copies in modules stay, and each module says so, until you remove them.
  • One hkj-openrewrite release takes a 0.4.x project's Try.fold calls to 0.6.0 (#546). The swap in MigrateDeprecationsTo0_5_0 now leaves 0.6.0's fold alone, since it swaps only a fold declared with the success function first. So run the 0.5.0 group before the move and the 0.7.0 group after, both from 0.6.x. See 0.5.0 deprecation migration.
  • An OpenRewrite recipe adds the Path family to capability types (#1314). org.higherkindedj.openrewrite.AddPathFamily rewrites Chainable<A> to Chainable<?, A>, and likewise the other capability types, a PathProvider's createPath included. See 0.6.0 Path family.
  • javadoc runs in a build with the HKJ Gradle plugin applied (#1385). With preview features on, the default, javadoc received --enable-preview without the release it needs, so javadoc failed, and so did build in a project that publishes a javadoc jar. The plugin now passes --release as well, unless the task passes its own -source or --release. See Defaults.
  • The benchmark options the docs describe now work (#1439). The benchmarks read only -Pincludes, so -Pjmh.iterations, -Pjmh.fork, -Pjmh.profilers=gc and the rest did nothing, and the --includes most pages gave failed. The build now reads each one, and Benchmarks lists them.
  • A generator plugin needs only hkj-processor from HKJ (#1376). BaseTraversableGenerator moves there under the same name, and javapoet, whose types the generator interface uses, comes with it. A plugin's build can drop a javapoet line it lists by hand, or an hkj-processor-plugins line it added to reach the base class. Its module-info.java keeps requires com.palantir.javapoet;. See Step-by-Step Example.
  • The 0.5.0 migration rewrites and marks more (#1369, #1370, #1545). A Void success becomes Unit, and a Void error is marked on the Paths, Validated and EitherOrBoth too. More nulls that 0.5.0 refuses are marked, with a lambda's mark on the null it returns. See 0.5.0 deprecation migration and Void becomes Unit.
  • A source set using @GenerateMapping, @GenerateMerge, @GenerateIsos, @GenerateErrorEnvelope, @PathSource or @HkjHttpClient compiles incrementally (#855). Every change recompiled it in full. The first five are now kept in the class file, and Gradle regenerates a client only when recompiling it. A build set up by hand needs -parameters, and a modular one under -Werror needs -implicit:class; the HKJ plugin adds both.
  • An incremental build refuses a class name a hand-written class already has, as a clean build does (#1601). Most generators, @GenerateLenses and @GenerateFocus among them, wrote over such a class there, and over a dependency's in any build. Both builds now give the same error before writing. See Incremental compilation.
  • The generators say clearly what an older Java release cannot compile (#1586, #1620, #1621, #1656, #1657). @GenerateMapping and @GenerateMerge refuse Java 15 or earlier, and a mapping of lists, sets or maps compiles at --release 16 to 20. At Java 17 to 20, a sealed mapping pair, @GenerateErrorEnvelope and @EffectAlgebra are refused with one error. See Rules and Limits.
  • A FieldMask update compiles at --release 16 to 21 (#1667). Its Impl passed an unnamed _ lambda parameter, which javac accepts from Java 22, so javac refused the generated file. It now names the parameter.

Documentation

  • Corrections across the docs, javadoc and skills (#1290, #1278, #1307, #1362, #1396, #1338, #1577, #1603, #1674, #1681). They cover when a StreamPath reads its source, examples that mixed kinds of Path, and the Profunctor and VTask javadoc. The cheatsheet, examples guide, optics Compiler Messages page and three skills are updated too. See Choosing the Right Streaming Tool and Composition Patterns.
  • The glossary gains thirteen Effect Paths and three type classes (#1301, #1258, #1263, #1264, #1527). The type classes are MonadReader, MonadState and MonadWriter. See Effect Paths.
  • You can have NullAway flag a null returned through VTask.of or Try.of (#1371). In JSpecify mode alone, NullAway never checks what a lambda returns when passed as a JDK Supplier, Callable or BiFunction, as to VTask.of, Try.of or IO.delay, so the computation fails only when it runs. Two NullAway options make it check them. See What a nullness checker sees.
  • You can learn the type classes from one tested example. Most Foundations pages and Tutorial 00 use the order service the Optics and Mapping chapters share. Each core type's page opens with a card saying when to reach for it, Supported Types is rebuilt around those cards, and a new page lists where an instance bends a law. See Foundations.
  • The book says more clearly when to reach for EitherPath and VResultPath (#1466, #1467). Stay on Either to hold and pass a result, and lift it to run steps along it. Async work with a typed error now points to VResultPath.
  • Ask a question on any page of the book (#1528). An "Ask about this page" icon beside "Suggest an edit" opens a question thread for the page, kept in GitHub Discussions, and shows how many questions it already has.
  • More help upgrading to 0.5.0 (#1368). The Upgrading page says a 200 response that answered Right(null) now sends no body, and that hkj-spring brings Spring Boot 4.1's own changes. Migration Recipes shows how to run the recipes without changing the build, and how to give a large build more heap. See To 0.5.0.

Thank you

Twenty-four people contributed pull requests to this release. Thank you to each of them:

  • @aklinedev: glossary entries for TryPath and ValidationPath, and a ConfigContext.contramap that takes functions with wider bounds.
  • @AmishaNATH2003: Maybe.fromEither, and tests for NonDetPath.foldLeft given a null function.
  • @AnushreeKasturi: foldRight, fold and foldMap on NonDetPath.
  • @anzikidis: toOptional() and swap() on Either.
  • @bardrop: Lazy chains that run each step once, across threads too, a retry that stops once its circuit breaker opens, and nullness refinements to getOrElseGet, OptionalContext.io and AffinePath.ofNullable.
  • @Beehtrix: a clear refusal for @GenerateErrorEnvelope at Java 17 to 20, generator plugins that name a class more than once, and @HkjHttpClient diamonds that differ only in @SuppressWarnings.
  • @buzztouniverse: bean fix lines that compile once followed, and an OpticOpFunctor.map that applies its function.
  • @canakyuz: glossary entries for FreeApPath, FreePath and GenericPath, and StreamPath pages that no longer call a source lazy where it is read at once.
  • @ColumbusLabs: generated code that compiles on older Java releases or says why it cannot, null refusals that name the right accessor, safer merges into non-null collections, and @ThroughField finding an inherited getter.
  • @dannyward630: a clearer explanation of how a StreamPath reads its source.
  • @Daulat1249: unsafeRun() and runAsync() on VResultPath, toListPath, fold with a nullable result type, the move to spring-boot-starter-webmvc, and associativity tests for every shipped Monoid.
  • @dtsiaves: VTask.asCallable throwing a task's own Throwable unchanged.
  • @EnesKartal: fold on Maybe, MaybePath and OptionalPath, the reader, state and writer type classes in the glossary, and guidance on when to lift an Either to an EitherPath.
  • @Imcharan17: Monoids.list(), set() and string() that combine many values in linear time.
  • @KTH1007: Semigroups.string, Monoids.maximum and Monoids.minimum that refuse a null argument when built.
  • @loveyadav8478-blip: an injected TimeSource in the audit-log example.
  • @ManosHatzi5: the HashMultiSet traversal generator.
  • @Max-WX-Chen: the discarded-effect check for a dropped VTask, memoize() on VResultPath and VTaskContext, and clearer messages for a missing handler and a mismatched zipWith.
  • @MaxonT: pointing Where to Start and Path or Transformer? at VResultPath.
  • @minutechreview: ensure on EitherPath, six new NonDetPath operations, an injected TimeSource in the shipping example, and four glossary entries.
  • @prash-spartanx: Either.fromOptional.
  • @Rishankgupta08: toOptional() on Try and Validated.
  • @sanidhya02: a fix for a @GeneratePathBridge crash on an inherited generic method, and a clear refusal of a Void-bounded @HkjHttpClient success type.
  • @tramslegend: glossary entries for ListPath, NonDetPath, StreamPath and VStreamPath.

Upgrading from 0.5.0

Before you upgrade

  • From 0.5.x, run MigrateDeprecationsTo0_6_0 while still on 0.5.x (#1679). 0.6.0 removes a Focus path's untyped shortcuts, and the recipe finds a call to one only while the method exists. It rewrites the call to its typed form, or marks one the typed form does not fit. See 0.6.0 deprecation migration.
  • From 0.4.x, run MigrateDeprecationsTo0_5_0 while still on 0.4.x (#546). fold returns on Try and TryPath, failure first. A success-first fold left from 0.4.x compiles again where both functions accept either argument, and runs them swapped: t.fold(v -> true, e -> false) now gives true for a failure. Rebuild what was compiled against 0.4.x too. See To 0.6.0.
  • Expect the HKJ skills at the root of your build (#1373). The Gradle plugin, and mvn hkj:install-skills, put a copy in each module. Both now install once, at the root, and leave the module copies alone. Each module that holds one says so until you install at the root and remove it.

What a running program can notice

Mapping

  • A map's null key is a failure parse reports, not an exception (#1515). A generated parse, patch, updateFrom or fallible merge, and parseValues, parseKeys and parseEntries, threw NullPointerException; each now returns Invalid, so catching that exception no longer catches it, and Spring answers 422, not 500, by default. The build bulk forms still throw. See The null contract, precisely.
  • A null inside a map's key fails parse (#1525). A generated parse, patch, updateFrom or fallible merge answered Valid where a key it hands on as it is, a container such as a List<String>, held a null, and handed the domain that key. Each now answers Invalid, located under the key. See The null contract, precisely.
  • A mapping refuses a map holding two keys that equals cannot tell apart, unless it is an IdentityHashMap (#1483). A same-typed Map copy, parseValues and buildValues lost an entry; they now throw. Hold such a map as an IdentityHashMap, which comes back a writable one, so look its keys up by the same object. See Same-typed containers cross as copies.
  • Two results of one sparse update no longer share a copied array (#1542). An update from updateFrom, applied to several records, handed each the same array. Each apply now allocates its own, so two results that were equal, as records whose equals compares an array by reference, no longer are. See Same-typed containers cross as copies.

Core types

  • Validated.map, and map2 to map5 on its monad, throw NullPointerException when their function returns null (#1318). They threw KindUnwrapException, so catching that, or IllegalArgumentException, around the call no longer catches it. See Values, never null.
  • FunctionKindHelper.narrow throws KindUnwrapException, as the other kind helpers do (#1318). A null Kind threw NullPointerException, so catching that no longer catches it. Another type's Kind threw IllegalArgumentException, which KindUnwrapException extends, so catching that still does. See When narrow throws.
  • A Selective of your own no longer runs the effects its condition skips (#1358), unless its select is built from ap. The default whenS ran its effect on a false condition, and the default ifS ran both branches, so a failing effect's error could hide the condition's. Run any effect you relied on yourself. The library's own instances are unchanged.
  • Context.recoverWith now catches a failure from an earlier map or flatMap function (#1443). Code that let such a failure escape a recoverWith gets the recovered value instead, and a recovery function's own failure reaches the next recoverWith out. A checked exception such a function throws, as Kotlin code can, reaches run() inside a ContextException, as one from fail does.
  • Free.foldMap into a Writer, List or EitherOrBoth gives what each step's value holds (#1460). A Writer's log is no longer empty, and an EitherOrBoth that warned gives Both, where it gave Right. A List target runs the rest of the program, and its interpreter, once for each element a step gives.
  • Const and the optics' folds refuse a null value (#1470). new Const<>(null) throws NullPointerException, as does a mapFirst or bimap function returning null. A traversal's fold fails where its function or monoid gives null, where before the monoid got the null. A side-effect fold needs a Monoid<Unit>, not Monoid<Void>. See Values, never null.
  • A FreeAp interpreter is handed the instructions in the order the program was written (#1470), not in reverse. An interpreter that acts as it is called, such as one into Id that logs or calls a service, now does so in that order. Results, and the failures Validated accumulates, were already in order.
  • A Lazy step's flatMap function runs once (#1608, #1611). A function with a side effect ran again each time a Lazy built on its step was forced. A step now reports isEvaluated() once its chain is forced, and a thread forcing a step that another is working out waits for it.
  • A deep recursion through Lazy.flatMap keeps every level until it ends (#1608). Each level's Lazy now caches the value the recursion ends with, so each is kept until that value is known, where before it was let go once passed. A recursion a million levels deep may need a larger heap; Trampoline runs one that deep without keeping its levels.
  • Lazys that need each other no longer overflow the stack (#1611). A Lazy that needs its own value, or two that need each other on one thread, fail with IllegalStateException. Forced on two threads, two such Lazys wait for each other for ever, as two Lazy.defers already did.
  • A Lazy tries its work again after running out of memory or stack (#1655). An OutOfMemoryError or a StackOverflowError is still thrown, but leaves the Lazy unevaluated, so the next force() runs the work again. Before, every later force() threw the same error. A LazyPath does the same. See When the work fails.
  • Semigroups.string(delimiter), Monoids.maximum(comparator) and Monoids.minimum(comparator) refuse a null argument (#1365). Each throws NullPointerException when called. A null delimiter used to join strings with the text null, and a null comparator threw only once two present values met.

Optics

  • Of two withers for one getter, @ImportOptics sets through the capitalised spelling (#1148): the lens for a class with both withEMail and witheMail beside eMail() set through whichever the class declared first. It now sets through withEMail, and a note names witheMail, which a spec interface's @Wither can choose.
  • An optic interpreter that wraps each result in Free.pure skips the operation's continuation (#1154): a program from OpticPrograms runs as before, but a function mapped onto an OpticOp, through OpticOpFunctor or Free.translate, is not applied. Hand the result to op.k() and return what it gives.
  • A traversal or fold over a null @Nullable container no longer throws (#1633). A catch of the NullPointerException it threw no longer runs, and a generator plugin's body no longer sees such a null. A fold over a null @Nullable value that is not a container finds nothing: getAll gives [], not [null], and length 0, not 1.
  • A sorted collection keeps its order through a generated optic (#1430). A traversal over a PSortedSet or PSortedMap, and a Focus path over those or an Eclipse Collections sorted set, gave back a custom-ordered source in natural order. It now keeps the source's order. Where code relied on the re-sort, sort the result itself.
  • A map optic refuses any map but an IdentityHashMap holding two keys that equals cannot tell apart (#1458), such as a HashMap whose key changed after it went in. Writing one lost an entry; it now throws IllegalArgumentException. Copy such a map into an IdentityHashMap first. An IdentityHashMap comes back one, so look its keys up by the same object.
  • A null optic, modifier or predicate fails when the program is built (#1315). Each OpticOp record throws NullPointerException, and so does an OpticPrograms factory that builds one. It used to fail only when an interpreter ran the program. The validating interpreter no longer reports one as a failed operation. set and setAll still accept a null new value.
  • TraversableGenerator.recordTypeName names the record's type variables without their bounds (#1594). The generated code is the same, since a type argument never writes its bounds. Only a generator plugin that reads bounds() from what it returns can tell. To declare a type variable, call ProcessorUtils.typeVariableOf(context.elements(), parameter, context.targetPackage()).

Effect Paths

  • A ValidationPath keeps its own semigroup through a step (#1314): the result of via, then, recoverWith and orElse accumulated with the step's semigroup, and now accumulates with the receiver's. After mapError, whose placeholder semigroup throws, a later accumulation now throws even past a step that had a semigroup; use mapErrorWith instead.
  • An EitherOrBothPath keeps its own semigroup through a recovery (#1314): the result of recoverWith and orElse accumulated with the recovery's semigroup, and now accumulates with the receiver's, as via and then already did.
  • mapError on MaybePath, TryPath and CompletableFuturePath applies the mapper (#1332): it used to hand back the same path, and it never called the mapper. A failure now runs the mapper, and recover sees that error. MaybePath and TryPath return an EitherPath. CompletableFuturePath returns a VResultPath. mapException still stays a TryPath.
  • toEitherPath and toMaybePath on a cancelled CompletableFuturePath no longer throw (#1354). They give Left of the CancellationException, and Nothing. toTryPath on a failed future holds that future's exception. Code which caught a CancellationException around toEitherPath or toMaybePath, or matched a CompletionException in a toTryPath failure, no longer sees one.
  • A VStream's recoverWith, mapError and onError now handle a failure at a later element (#1029). A failure at the second element went straight through them, so a fallback stream, an error mapper or a logging hook now runs where it did not. recoverWith, and recover when it ends the stream, close what they stop reading.
  • A failed mapTask element holds its place in a VStream (#1029). After a recover, later elements pass through the operators between, and drop can discard the failure. A finaliser or bracket release runs at close, not at the failure.
  • A recover placed after some failures ends or continues differently (#1029). After merging several streams it ends the stream. After an exception with suppression disabled it carries on.
  • Chunking and parallel operators do more work around a failure (#1029, #1437). chunk, chunkWhile, mapChunked and parEvalMap run for the elements read before it, then fail, so a forEach or headOption sees them. A failed parallel task no longer cancels the others, so without a recover a failing parEvalMap run waits for its batch's slowest task.
  • Code that pulls a VStream by hand gets a Step.Fail for a failed task, where the pull threw (#1029, #1437). That covers mapTask and the parallel operators, whose null results and failing parEvalFlatMap functions count too. Close or read on from its tail. An instanceof chain or default branch misses it, and an exhaustive switch compiled against 0.5.0 throws MatchException.
  • A VStream hands over a checked exception as its task threw it (#1410). Code that called getCause() on a VTaskExecutionException from runSafe, or on a RuntimeException from parEvalMap, parEvalMapUnordered, merge or fromPublisher, now receives the exception itself, as it does from a finaliser. run() still wraps one.
  • A forked task's Throwable that is neither an Exception nor an Error is no longer wrapped (#1418). Code that called getCause() on the RuntimeException from Par, Scope.join, parEvalMap or parEvalMapUnordered now receives the Throwable itself. So does a caller of asCallable().call(), where a catch (Exception e) no longer catches it.
  • A VTaskPath handler sees a checked exception as its task threw it (#1396). Code that called getCause() on a VTaskExecutionException now receives the exception itself. That holds in runSafe and catching, in a handler or retry after via, in the future from runAsync(), and in VTaskContext.runOrElseGet and StreamTraversal.modifyVTask. unsafeRun() still wraps one.
  • recover, recoverWith, mapError and toEitherPath on a CompletableFuturePath keep a CompletionException that has no cause (#1398). A handler that was given an empty RuntimeException now gets the CompletionException.
  • A timed-out task is interrupted, and the timeout waits for it to stop (#1372). A task blocked in CompletableFuture.join(), or otherwise out of an interrupt's reach, holds the failure back until it finishes, and an interrupt of the caller now waits for it too. To fail at the time limit, as before, time out task.detachOnCancel().
  • A half-open CircuitBreaker limits its probes (#1481). Once successThreshold probes are running or have succeeded, other calls get a CircuitOpenException with status HALF_OPEN, so accept that beside OPEN. A probe an interrupt cannot reach holds its place until it stops; protect task.detachOnCancel() to free it.
  • A CircuitBreaker counts some calls differently (#1481). A call still running when the circuit changes state, by reset() or tripOpen() too, no longer moves it, though the metrics count it. A recordFailure predicate that throws counts a failure, and the call's own exception reaches the caller.
  • A call that one CircuitBreaker guards twice counts each attempt once (#1482). Its metrics() counted each outcome at both guards, so a circuit opened at half its failureThreshold. A fallback between the guards also kept the circuit closed. Now the circuit opens, and the outer guard turns calls away before the fallback runs, so put the fallback outside it.
  • A retry that ResilienceBuilder or Resilience puts round a circuit breaker throws the CircuitOpenException (#1506). It retried it until maxAttempts and threw RetryExhaustedException. Code that caught RetryExhaustedException there should handle CircuitOpenException too.
  • A call that one Bulkhead guards twice holds one permit (#1502). It held two, so half as many such calls ran at once. Now twice as many can reach the dependency, so lower a limit you raised to make room. A fork, or a task detached with detachOnCancel, still takes a permit of its own.
  • A fromPublisher stream subscribes when a run's first pull runs, not when it is built (#1442). A hot publisher, such as a SubmissionPublisher, sends a run only what it publishes after the run subscribes, so what it publishes between building the stream and reading it is lost. Publish once the run has subscribed, which getNumberOfSubscribers() shows.
  • Code compiled against 0.5.0 that calls GenericPath.mapK or a VStreamTransformations method must be recompiled (#1455). Each now names Natural in its signature, so the old call fails with NoSuchMethodError. A mapK call that passes a NaturalTransformation still compiles, with a removal warning.
  • A VStream's recover, recoverWith, mapError and onError let an interrupt through (#1428). Their functions saw it, so recover ended the stream with its value, mapError replaced it and an onError hook logged it. Now the run fails with the InterruptedException. To give a value when a run is stopped, recover outside what stops it, as in toList().timeout(d).recover(e -> List.of()).
  • A VStream terminal operation on an interrupted thread fails before it reads (#1428). It read to the end unless a pull blocked. run() and runSafe() leave the status set after an interrupt, so a thread that goes on to read another stream fails at once. On a thread meant to carry on, clear the status first with Thread.interrupted().
  • VStreamPar.merge fails with the InterruptedException when its reader is interrupted (#1428). It threw a RuntimeException with the message "Merge interrupted". Now runSafe() gives the InterruptedException, run() throws it wrapped in a VTaskExecutionException, and a recover after the merge lets it through. Where code matched the message, match the InterruptedException instead.
  • prepend leaves the stream after its element alone until it is read (#1428). headOption() or take(1) after prepend closed that stream, running its onFinalize finaliser though nothing had read it, where VStream.of(x).concat(stream) did not. To run a finaliser however far a run reads, attach it after prepend. See onFinalize.
  • Closing a VStream you pulled by hand no longer closes that run (#1461). On a bracket, merge, fromPublisher, parEvalMapUnordered or onFinalize stream, close() after a pull ended the latest run, which could be another thread's. Close the tail the pull gave you instead. To stop another thread's run, time it out or interrupt that thread. See Pulling by hand.
  • VStream.fromStream closes the Java Stream when a run that pulled it ends (#1029). An onClose handler that throws now fails the run. A later run reads on from the closed stream, so over a file it can fail. Read a file afresh each run with bracket, or read on with fromIterator(stream.iterator()). See A file, a line at a time.
  • A multi-source merge tail pulled again gives the step it gave before (#1029). Pulling one tail again, or running its pulled VTask again, took the next element. Code that read a merge that way now gets the same element each time, and never ends: move on to the tail each step gives.
  • A fromPublisher, parEvalMapUnordered or merge tail pulled by hand on an interrupted thread gives a step that needs no wait (#1562). An element already buffered threw InterruptedException, through run() and runSafe() too, as did a kept fromPublisher or parEvalMapUnordered step. An interrupted wait still throws, and now sets the status again for all three. Terminal operations are unchanged.
  • getOrElseGet on a Path, and orElseGet on a Maybe, throw when the supplier returns null (#1489). They handed the null back. Code that relied on that gets NullPointerException, with supplier must not return null, or otherSupplier on a Maybe; return a value from the supplier.
  • cancel(true) on a future from runAsync() interrupts the task (#1412). A sleep, wait or blocking socket call in it fails. The same holds for EffectBoundary.runAsync, and for a CompletableFuturePath over such a future, including one made by withTimeout or completeOnTimeout. A map or via breaks the chain. See CompletableFuture.
  • Every built-in Path's type-mismatch message names the method and both Path types (#401), and points to conversions and the Path factories. A raw type, an unchecked cast, a hand-written Combinable or a 0.5.0 build reaches it. Match the type names where code matched the old text, MaybePath's included. See A step that returns the wrong kind of Path.
  • A @PathSource Path's zipWith uses the built-in Paths' type-mismatch wording (#1559). The message names both Path types and points to conversions and Path factories. Code that matched Cannot zipWith non-TracedPath can match the new prefix Type mismatch in zipWith(): expected TracedPath. See Choosing a capability.
  • An Effect Context's via no longer checks its step's kind when the chain runs (#1567), since javac checks it. A jar built against 0.5.0 that hands via another kind of context gets a ClassCastException in place of an IllegalArgumentException. One that calls via on an EffectContext gets a NoSuchMethodError. Rebuild it against 0.6.0.

Spring

  • A Unit inside a JSON body writes null, not "()" (#1522). A client that read that string, or "INSTANCE" under spring.jackson.use-jackson2-defaults=true, now gets null. Upgrade the services that read it first: before 0.6.0, a reader refuses the null or takes it as a Java null, and an @HkjHttpClient throws on a Unit error.
  • A Unit error no longer fails to decode (#1522). With the default decoder, an @HkjHttpClient method whose error type is Unit threw ResponseErrorDecodeException for an empty or foreign error body. It now gives Left(Unit.INSTANCE), so code that caught that exception, and a retry or circuit breaker that counted it, sees the Left instead.
  • A Void error type fails when its decoder is built, not on each error response (#1536). JsonResponseErrorDecoder and the default factory throw IllegalArgumentException for Void, naming Unit. So a client generated before 0.6.0 with a Void error type stops the application at startup, as does a Void in hkj.client.status-error-mappings, even one no method used.
  • A primitive in hkj.client.status-error-mappings stops the application at startup (#1546). A mapping such as 404: int applied to no method, so a 404 decoded as if the line were not there. It now fails at startup, naming the property and the status, and JsonResponseErrorDecoderFactory refuses one when it is built.
  • A request that times out interrupts its task (#1412). This covers a VTaskPath, and a CompletableFuturePath over runAsync(). The 504 goes out as before. Start work that must outlive a VTaskPath response with its own runAsync() inside that path, or raise hkj.virtual-threads.default-timeout-ms. For a future, the limit is hkj.async.default-timeout-ms.
  • ObservableEffectBoundary.runAsync passes a cancel through to the program, and records it (#1412). Cancelling its future, with either flag, interrupts the program and counts the invocation once, as an error, CancellationException. A cancel used to leave the program running and record nothing.
  • An @HkjHttpClient with no type-level @HttpExchange of its own uses its base's (#1561). Its requests now carry the base's URL prefix, media types, headers and version. If the group's base-url holds the prefix, take it out, or requests send it twice. A base with two that differ stops the application at startup, as Spring does.
  • An @HkjHttpClient whose group names a constant another processor writes joins that group (#1584). It was registered under the group "<error>", so the group's spring.http.serviceclient.<group>.* properties, such as its base-url, now apply to it.

What stops a build that compiled

AreaNow fails the buildDo thisIssue
Build and toolingWith the HKJ checker enabled, a bare statement that builds and drops a VTask, such as ref.set(7);. The diagnostic begins This VTask is built but never usedRun, return or compose the task. For an intentional discard, put @SuppressWarnings("discarded-effect") on the narrowest declaration around it. A statement that reads a task out of something else, such as future.join(); on a CompletableFuture<VTask<A>>, is reported too, though it built nothing; suppress it the same way (#1687)#1662
Effect PathsA chain step of another kind of Path, or with an error, environment, state, log or witness type the chain does not carryConvert the step, map its error, or type the chain on the wider error where it starts, as Common Compiler Errors shows#1314
Effect PathsCode that names a capability type with its old arguments, such as Effectful<A>, or a PathProvider returning Chainable<A>Write Effectful<?, A>, or <P, A> Effectful<P, A> in a helper that chains. The AddPathFamily recipe writes the first#1314
Effect PathsA chain whose receiver is typed with a wildcard error, such as EitherPath<? extends AppError, String>Widen it first, as in p.<AppError>mapError(e -> e).via(...), or declare it as EitherPath<AppError, String>#1314
Effect PathsA pattern or cast from a capability type to a concrete Path, such as case MaybePath<String> m on a Chainable<?, String>; a cast is unchecked, so it fails under -WerrorMatch from Composable<String>, or build the concrete Path directly#1314
Effect PathsA step after mapError on a MaybePath, TryPath or CompletableFuturePath that returns the Path it started fromReturn an EitherPath from the step (a VResultPath after a CompletableFuturePath), or use recover or mapException before changing the error type#1332
Effect PathsA via step on an Effect Context of another kind of context, or with an error, configuration or state type the chain does not carry. Also a step or receiver typed as EffectContext, a chain started on one variant of its error, and a receiver typed with a wildcard, such as ErrorContext<F, ? extends AppError, A>Convert or map the step, as What a Step May Return shows. Declare a helper's return type as its concrete context. Widen an error where the chain starts, as in .<AppError>mapError(e -> e), and a ? super R receiver with .<R>contramap(r -> r). A step that calls a method on a factory's result names the factory's types, as in ErrorContext.<AppError, String>success(id).map(f)#1567
Build and toolingA Gradle build set up by hand for a modular source set, built with -Werror and using an annotation that now compiles incrementally: javac warns Implicitly compiled files were not subject to annotation processingAdd -implicit:class, which the HKJ Gradle plugin adds, as Incremental compilation shows#855
MappingIn an incremental Gradle build without -parameters, a @GenerateMerge spec that Gradle did not recompile: was read from a class file that records no parameter namesCompile with -parameters, which the HKJ Gradle plugin adds, as Incremental compilation shows#855
SpringA bare @PathVariable, @RequestParam, @RequestHeader or @CookieValue on a method a client inherits from a jar's base compiled without -parameters, which bound the name arg0 at run time: cannot name the binding ofCompile the base with -parameters, write the name, as @PathVariable("id"), or redeclare the method on the client#855
SpringIn an incremental Gradle build without -parameters, the same bare binding on a method inherited from a base of your own source set that Gradle did not recompile: cannot name the binding ofCompile with -parameters, which Spring Boot's Gradle plugin and the HKJ Gradle plugin add#855
MappingWith a Lombok older than 1.18.34, in an incremental Gradle build, a mapping over a Lombok bean Gradle did not recompile, whose methods it then reads as hand-written: a refusal a clean build does not makeUse Lombok 1.18.34 or later, or set lombok.addLombokGeneratedAnnotation = true in lombok.config#855
Build and toolingA class no HKJ generator wrote, such as a dependency's or a hand-written one Gradle did not recompile, with the name of a class a generator writes: has the name of a class no HKJ generator wroteRename that class, or the type the class is generated from, or set targetPackage; for a Path, set a suffix that names a free class#855, #1601
OpticsAn optic interpreter or other code of your own that names an OpticOp record: a pattern or type such as OpticOp.Get<?, ?> or OpticOp.Set<S, A>, or a constructor call such as new OpticOp.Get<>(source, getter)Add the third type argument, as in OpticOp.Get<?, ?, ?>, and pass a continuation, Function.identity(), to a constructor. Hand each result to op.k() and return what it gives, in place of Free.pure(result)#1154
Effect PathsAn exhaustive switch over VStream.Step, in code that pulls a stream by hand or in a stream of your ownAdd a Step.Fail case. A stream of your own passes it on with itself over the tail, as its Emit case does; code that stops there closes the tail and throws the error#1029
OpticsA record that declares its own accessor for a field marked with a @Nullable that then reaches only the backing field, as AndroidX's, SpotBugs' and JetBrains' before 17.0 do, or with a TYPE_USE @Nullable on that accessor's return type alone: the field's Focus method gives an AffinePath where it gave a FocusPath, and its navigator an AffinePath formType the variable as AffinePath, and read with getOptional, as for any nullable field#1633
OpticsA call to the traversal @GenerateTraversals generated for a sorted container with a wildcard where it is ordered, such as PSortedSet<? extends String> or PSortedMap<? extends String, V>. The method is no longer generated, and a note says whyDeclare the component with concrete type arguments, such as PSortedSet<String>#1430
OpticsWith widenCollections = true, a Focus method over a commons-collections4 HashMultiSet or TreeMultiSet component used as its old path to the whole multiset: it now steps into the elements. Also such a component with a wildcard element, such as TreeMultiSet<? extends Leaf>, which @GenerateFocus now rejectsUse the path over the elements, or keep the multiset's own path from its lens, FocusPath.of(SLenses.tags()), adding @GenerateLenses if the record lacks it. Name the element type, as in TreeMultiSet<Leaf>#1379, #1587
OpticsA TraversableGenerator plugin that extends a built-in generator, such as ListGenerator or OptionalGenerator, or a base class the third-party ones share, such as GuavaBaseSingleIterableTraversableGenerator, and overrides a form of generateModifyF that takes no GenerationContext. Those forms are now final: hkj's processors call the context form, so the override would be passed over. A plugin jar built against an earlier release that does so cannot be loaded, and is reported as an errorOverride the GenerationContext form instead, naming each type with context.typeNameOf(type), and rebuild the plugin; a user of the plugin updates it to a release built for 0.6.0#1583, #1605
OpticsA generator plugin that calls one of four ProcessorUtils methods that 0.5.0 had: rawTypesSuppression(TypeMirror, TypeElement), rawTypesSuppression(TypeMirror, List), namesRawType(TypeMirror, TypeElement) or warningSuppression(boolean, boolean)In place of rawTypesSuppression(type, owner), call writtenTypesSuppression(context.elements(), type, owner), and likewise for the form that takes type parameters. It also suppresses a deprecated type the member names. Pass namesRawType(List) the type and the bounds of the owner's type parameters. Pass suppression the Lint constants a member needs, such as List.of(Lint.RAWTYPES, Lint.UNCHECKED)#1375
OpticsA generator plugin that names one of the helpers only hkj's own processors use, which 0.5.0 had in org.higherkindedj.optics.processing.util: Diagnostics, ExcludeFromJacocoGeneratedReport, NamingConvention, NestedOptic, NestedTypeNames, OpticExpressionResolver, ProtobufCollection, Reachability, SubtypePrismGenerator or TypeKey. They have moved to a package hkj-processor does not export, and can change in any release. util now holds only ProcessorUtils and Lint. A plugin jar built against 0.5.0 that names one stops the build when the processor runs it: NoClassDefFoundError: org/higherkindedj/optics/processing/util/…Copy what the plugin needs into it, or build it from ProcessorUtils, the GenerationContext the plugin is passed, and javapoet, as the Implementation Tips say, and rebuild the plugin; a user of the plugin updates it to a release built for 0.6.0#1592
Effect PathsCode compiled against hkj-processor on the module path that names PathProcessor, PathSourceProcessor, EffectAlgebraProcessor or ComposeEffectsProcessor, such as to hand one to javac's API. Their package is no longer exported, and the optics processors' never wasLet javac load the processors from the processor path or --processor-module-path, as the HKJ Gradle and Maven plugins set it up. Code that needs an instance gets it from ServiceLoader.load(Processor.class); a named module declares uses javax.annotation.processing.Processor for that#1592
OpticsA record that names a type another processor writes is now generated once that type exists, and checked as if written by hand. So a -Werror warning the processor could not reach before now fails the build, as does a type-use annotation whose class literal names a class the record's generator writesDo what the warning asks. For the annotation, name a hand-written class or leave it off. See Compiler Messages#1598
OpticsA call to a Focus path's no-argument each(), some(), head(), last(), tail(), init(), cons(), snoc(), headTail() or initLast(), or to its at(index), atKey(key) or traverseOver(traverse): cannot find symbol, or cannot be applied to given types for each() and some()Run MigrateDeprecationsTo0_6_0 while still on 0.5.x, or write the typed form that Removals in 0.6.0 gives, as the message's entry shows#1679
Effect PathsA @Handles interpreter, @ComposeEffects record or @GeneratePathBridge interface that depends on a type another processor writes is now checked as if written by hand. A missing handler, a component without @EffectAlgebra or an unbridgeable inherited @PathVia method now fails. Gradle's incremental build refuses some of these types outrightDo what the message asks. For an incremental refusal, build from clean or declare the type in source, as Incremental compilation says#1614, #1622, #1623
Effect PathsCode that keeps a VStreamTransformations result as a NaturalTransformation, such as NaturalTransformation<ListKind.Witness, VStreamKind.Witness> nt = VStreamTransformations.listToVStream()Declare it Natural, as the MigrateDeprecationsTo0_7_0 recipe does#1455
Effect PathsA method reference to listen on a WriterPath, such as path::listen, passed where only the reference could give its parameter types, as to a generic method, or to a method overloaded for a Supplier and a Function. WriterPath now has listen() as well as listen(log)Give the reference a target type, as in Function<List<String>, WriterPath<List<String>, Integer>> append = path::tell, or write a lambda that names its parameter's type, (List<String> log) -> path.tell(log)#1450
Effect PathsA method reference to of or pure on a RECOVERABLE @PathSource Path, such as OutcomePath::of, passed where only the reference could give its parameter types, as to a generic method, or to a method overloaded for functional interfaces of two and three parameters. The Path now has a one-instance form of eachWrite a lambda that calls the form you mean, as in (kind, monadError) -> OutcomePath.of(kind, monadError)#1007
Effect PathsA call to ScopeJoiner.resultEither()Call joinEither() on the Scope in place of join(). With a StructuredTaskScope you open yourself, use the value its join() returns, or the cause of the FailedException it throws#1680
MappingA @Nullable value that build, or a plain merge, hands where it cannot be taken. That is a component copied into a site declared non-null, or handed to a leaf, a nested spec, a lifted container, an Optional leg, a flattened group, a oneof, a @Singular method, a getter-only list or a protobuf-java setter. It is also an element or map key, or one inside a key, copied, converted or passed through where it cannot be taken, and a type argument a nested spec takes, or builds into a wire site, that rules it out. A type argument counts as the spec writes it, and a merge counts a @Nullable on a source record's own accessor, and one on its elements at the component or at the accessorMark the site @Nullable, hold a nullable component as an Optional the bridge carries, add ignoreNullCollections = true to a @Singular, let the nested spec's types take the null, or declare the source non-null#1431, #1503, #1525, #1635, #1639
MappingA call to asIso() or asLens() on a record mapping whose wire, at a component or at its own accessor, declares the component, or its elements, map keys or what a key holds, @Nullable where the domain declares them non-null. The method is no longer generatedCall asValidatedPrism() in place of asIso(), or patch(domain, wire) in place of asLens(): each reports the null as a located error. Or give the pair one nullness#1501, #1515, #1525, #1635
SpringAn @HkjHttpClient method whose error type is Void, as in EitherPath<Void, T> or VTaskPath<Either<Void, T>>, or an @OnStatus(error = Void.class) on a method whose error type is ObjectReplace Void with org.higherkindedj.hkt.Unit. The default decoder then reads no error body and gives Left(Unit.INSTANCE)#1536
SpringAn @HkjHttpClient method whose success type is a wildcard bounded by Void, as in EitherPath<E, ? extends Void> or MaybePath<? extends Void>, or a type variable bounded by Void on a generic clientDeclare org.higherkindedj.hkt.Unit as the success type, as for a declared Void#1544
SpringAn @HkjHttpClient interface that inherits one method from two declarations the generated client would write differently, such as two interfaces that each declare getUser(String) on a different path. The generated client followed one of themRedeclare the method on the client as it should be, as Generic Clients says. To keep what the client did, keep the method's Effect Path return type and copy the path and bindings from its method in the …HttpExchange your last build generated, with the @OnStatus overrides of the declaration they came from#858
SpringAn @HkjHttpClient interface with no type-level @HttpExchange of its own, where the processor now looks through the annotations on it and its bases. A missing class warns under -Werror or reports cannot tell whether, and a package-private annotation from another package is not publicDeclare @HttpExchange on the client, or add the dependency that declares the missing annotation or class#1561, #1571
Core typesA call to Instances.monadError, monadZero or alternative for a type whose instance lacks that capability, such as Instances.monadZero(either()), which threw ClassCastException. Also a MonadError declared with another error type than its instance's: MonadError<MaybeKind.Witness, String>, which threw once it raised a String, or MonadError<TryKind.Witness, Exception>, which ran. javac reports incompatible equality constraintsAsk for a capability the type has, and declare its instance's error type, as the table in Obtaining Instances lists: Unit for Maybe, and Throwable for Try, CompletableFuture and VTask, with each handler taking a Throwable#1321
Core typesCode that names a token's type with one argument, such as Witnesses.Of<MaybeKind.Witness>Write Witnesses.Of<MaybeKind.Witness, ?>, or var for a local variable. Code that passes the token to monadZero names that capability, as in Witnesses.Of<F, ? extends MonadZero<F>>, and likewise for monadError and alternative. A stream or list of tokens for different types reaches only monad, applicative and functor, so look each richer instance up before collecting them#1321
Build and toolingBuild logic that reads the hkjInstallSkills task's outputDir as a PathRead outputDir.get().asFile.toPath(), and expect .claude/skills at the root of the build in every project#1374, #1373
Build and toolingBuild logic that keeps the HKJ checker off one compile task by taking the Gradle plugin's -Xplugin:HKJChecker out of options.compilerArgs in an afterEvaluate or a doFirst. The plugin now passes it through an argument provider, so options.compilerArgs no longer holds it: the checker runs on that task, and where the task's processor path has no hkj-checker, javac says plug-in not found: HKJCheckerGive the task its own checker argument, whose disable= lists the checks to skip. A compile task outside the source sets, such as JMH's jmhCompileGeneratedClasses, also needs hkj-checker on its options.annotationProcessorPath, as Disable Compile-Time Checks says#1346

Deprecated for removal in 0.7.0

DeprecatedReplacementRecipe
VStream.closeAfterFailure(stream, failure)stream.close(); a failed mapTask task gives a Step.Fail, whose tail you close as an Emit'sBy hand
VStreamPar.parCollect(stream, batchSize)stream.toList()ReplaceParCollectWithToListRecipe, in MigrateDeprecationsTo0_7_0
VStreamPath.parCollect(batchSize)toList() on the pathReplaceParCollectWithToListRecipe
PathOps.parCollectVStream(path, batchSize)path.toList()ReplaceParCollectWithToListRecipe
Try.foldFailureFirst and TryPath.foldFailureFirstfold(failureMapper, successMapper), the same two functions in the same orderRenameTryFoldFailureFirst
Operation.FOLD_FAILURE_FIRSTOperation.FOLD, which Try.fold reportsBy hand
NaturalTransformation<F, G>, in org.higherkindedj.hkt.effectNatural<F, G>, which it extendsReplaceNaturalTransformationWithNatural, in MigrateDeprecationsTo0_7_0
FreePath.foldMapWith(interpreter, monad)foldMap(interpreter, monad)ReplaceNaturalTransformationWithNatural
FreeApPath.foldMapWith(interpreter, applicative)foldMapKind(interpreter, applicative)ReplaceNaturalTransformationWithNatural
WriterPath.listen(log)tell(log), which appends the same log. listen() reads the log, as MonadWriter.listen doesRenameWriterPathListenToTell, in MigrateDeprecationsTo0_7_0
A RECOVERABLE @PathSource Path's of(kind, monad, monadError) and pure(value, monad, monadError)of(kind, monadError) and pure(value, monadError), where both arguments are one instance: a MonadError is a Monad, so pass it once. Where they differ, pass a MonadError that also does what the Monad didRemovePathSourceMonadArgumentRecipe, in MigrateDeprecationsTo0_7_0
HttpHeaderCarrier, in org.higherkindedj.spring.web.returnvalueHttpHeaderCarrier, in org.higherkindedj.spring.http, which it extendsMoveHttpHeaderCarrierToHttpPackage, in MigrateDeprecationsTo0_7_0
ProcessorUtils.typeNameOf, resolvedTypeNameOf and typeVariableOf(parameter, targetPackage), in their forms that take no ElementsThe same call with the round's Elements first, from context.elements() in a generator. In a generator, context.typeNameOf(type) replaces typeNameOf(type, targetPackage)By hand
ProcessorUtils.typeVariableOf(parameter)typeVariableOf(elements, parameter, targetPackage)By hand
TraversableGenerator.generateModifyF(component, recordClassName, allComponents) and generateModifyF(component, recordClassName, allComponents, targetPackage), with the built-in generators' final forms of themThe GenerationContext form, the one a generator implements, naming each type with context.typeNameOf(type); context.targetPackage() is the package the String form is handedBy hand
BaseTraversableGenerator.getTypeArgumentName(component, index) and getTypeArgumentName(component, index, targetPackage)getTypeArgumentName(component, index, context)By hand
BaseTraversableGenerator.getGenericTypeName(component), with ValidatedGenerator'sgetTypeArgumentName(component, 0, context), or index 1 for a ValidatedBy hand

Previous: Unreleased: 0.7.0 Next: v0.5.0