v0.6.0 (6 December 2026)
New in 0.6.0
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.
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.
An error type states its own HTTP status
@ErrorStatus(409) on the variant replaces a class-name table or a naming rule.
Instances lookups are checked by javac
Instances.monadZero(either()) threw ClassCastException when it ran. Now it does not compile.
Builds with mappings stay incremental
A change beside @GenerateMapping, @GenerateMerge or @HkjHttpClient no longer recompiles the whole source set.
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.
Long Free, State, Coyoneda and FreeAp programs run without overflowing the stack, into the targets the chapter lists.
- 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
Instanceslooks up.Instances.monadZero(either()), which threwClassCastExceptionwhen it ran, is a compile error, as is aMonadErrordeclared with an error type its instance does not have. - A
VStreamrecovers from a failure at any element, and a terminal operation stops at an interrupt. - Long
Free,State,CoyonedaandFreeApprograms run without overflowing the stack, into the targets their chapters list. - Builds with mappings stay incremental, so a change beside
@GenerateMappingno longer recompiles the whole source set. RefandPromiseletVTasks share state, andmemoize()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
eMailsisseteMails, a primitive word such assetx(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
IdentityHashMapkeeps every entry through a mapping or an optic (#1483, #1458). Both rebuilt it as aLinkedHashMap, merging keys that were equal but not the same object. It now comes back anIdentityHashMap. See Same-typed containers cross as copies and TheforMapValues()Traversal. - A sparse update applied to several records gives each its own arrays (#1542). The results shared the one copy
updateFrommade of an array. Eachapplynow copies an array again, and anIdentityHashMaptoo, at any depth and through aJsonNullable. 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,
JsonNullablereads and protobuf-java writes took or held an undeclarednull, or lost the nullness inside aList<@Nullable String>or a passed-through key, so NullAway failed. WithJSpecifyJDKModels, a parsingOptionalfailed 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, inparseandbuildalike. It now names the array alone. See What lifts, and what does not. - The processor catches a
@Nullablevaluebuildor a plain merge cannot hand on (#1431, #1503, #1525, #1635, #1639, #1638, #1675).buildcopied anull, or one inside it, into a site declared to hold none. A leaf,@Singularmethod or protobuf-java setter threw on one. Hold a nullable component as anOptional, or give both one nullness. See Nulls. - A record mapping offers no optic that would hand the domain a
nullit rules out (#1501, #1515, #1525, #1635). Where the wire or its own accessor declares@Nullablewhat the domain declares non-null, the optics let in whatparserefuses. A full mapping has noasIso(); a projection maps aspatch. See Where a@Nullablerecord component lands. parsereports a map'snullkey, and one inside a key, beside every other failure (#1515, #1525). A generatedparse,patch,updateFromor fallible merge, andparseValues,parseKeysandparseEntries, threwNullPointerExceptionat anullkey; each now reportsmust not contain a null key. A generated one, which accepted anullinside 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, withat(index),atKey(key)andtraverseOver, compiled on any focus. Typed forms read the element from the path. A field named like one, such aslast, now gets a navigator. See A field named like a path method. @ThroughFieldauto-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@ThroughFieldAuto-Detection.- A class can declare several
@GenerateIsosmethods (#1601). A second one failed the build. Each method is now a field of one class named after the class declaring it, such asConvertersIsos, in the package itstargetPackagenames. 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
generateModifyFform that takes aGenerationContext. See Build-time impact and The TraversableGenerator Interface. - Optics over a null
@Nullablecontainer find no elements (#1633). A generated traversal or fold threwNullPointerExceptionthere. A@Nullablealso counts beside an accessor the record declares itself, so the field's Focus method gives anAffinePath. See Nullable Components and Where a@Nullablecounts. - Traversals over commons-collections4's
HashMultiSetandTreeMultiSet(#1379, #1587). A component of either type now gets a traversal. ATreeMultiSetis rebuilt with the source's comparator, so a custom order is kept. See Apache Commons Collections. @ImportOpticspairs a JavaBeans-spelt wither with its getter (#1148). AwitheMail(String)besidegeteMail(), as Lombok'sbeanspeccapitalisation writes them, gives aneMail()lens, aswithEMailbesidegetEMail()does. The processor says why it refuses a class whose only wither iswith2D(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 andCharSequence name()from another is now read as returningString, so aLens<Src, String>over it builds. A@ViaBuilderchain reads an inheritedtoBuilder()orbuild()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 generatedPerson::nameambiguous, so the lens, Focus path or navigator, getter, setter or@ImportOpticslens did not compile. A widened Focus path failed beside any other method of its field's name, such asitems(int index)besideList<String> items. See Path widening. - Generated code copes with more unusual names and types (#1643). A component or leaf named
yieldcompiles,@GenerateFocustakes 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. @GenerateFocusmessages 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.mapapplies its function (#1154). It returned the instruction unchanged, so code that mapped a liftedOpticOpfailed later withClassCastException. EachOpticOprecord now carries a continuationk, as an@EffectAlgebraoperation does, and an interpreter hands each result toop.k()in place of wrapping it inFree.pure. See What an interpreter actually is.- Generated optics over a sorted collection keep its comparator (#1430). Traversals and Focus paths over
PSortedSet,PSortedMapand the Eclipse sorted sets rebuild with the source's comparator, so a custom order is kept. The…Rebuildingfactories onTraversalsandEachInstancesdo the same for your own optics, andgetOrderedTypeArgumentIndex()for your own generators. See Sorted Variants and Comparators. StreamTraversal.toTraversal()works over aVStream(#1442). OnforVStream(), or a composition built on it, the result read its source twice, so afromIteratorsource came out empty, and threwNoSuchElementExceptionwhen 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 anull.AffinePath.ofNullable,OptionalContext.ioandJavaOptionalContext.iotake a function that never returns one.foldonEither,Tryand others takes a@Nullableresult type. See The bulk forms and Values, never null. - A warning suppressed on an
@ImportOpticslens stays quiet in an incremental build (#855). Gradle reads an unchanged spec from its class file, which keeps no@SuppressWarnings, soshorter-constructoranddropped-resultcame back and failed a-Werrorbuild. 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
viaor 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
viastep of another kind, or with another error, configuration or state type, compiled and could throw aClassCastExceptionlater. Chaining methods also take anErrorContextstep failing with a variant of its error, or aConfigContextstep reading less configuration. See What a Step May Return. ConfigContext.contramaptakes a function that reads a supertype or returns a subtype (#1576). It takesFunction<? super R2, ? extends R>, asReaderPath.localdoes, so a function held in a variable no longer has to name both configuration types exactly.EitherPathgainsensure(#1338):ensure(test, onFail)keeps a success whose value passestestand turns any other success into a failure built from its value, so a guard no longer needs anifreturning aLeft. See EitherPath.- A
RECOVERABLE@PathSourcePath takes itsMonadErroronce (#1007).of(kind, monadError)andpure(value, monadError)take the one instance, which composes the Path and recovers it. The forms that also take theMonadare deprecated for removal in 0.7.0, and theMigrateDeprecationsTo0_7_0recipe drops the repeated argument. See Recovery witherrorTypeand Deprecated for removal in 0.7.0. TrampolinePathandFreePathcombine three paths withzipWith3(#1302): both already combined two paths withzipWith. The three-way combine stays lazy untilrun()orfoldMap, so a deep chain stays stack-safe. See Combinable (Applicative).NonDetPathandStreamPathcatch up withListPath(#1337, #1322, #1152).NonDetPathgainslastOption,anyMatch,allMatch,takeWhile,dropWhile,get,foldRight,foldandfoldMap.ListPath,StreamPathandNonDetPatheach convert to the other two. See the Effect Path Cheatsheet.Monoid.ofbuilds a monoid from its empty value and its operation, andMonoids.bigDecimalAddition()sums money exactly (#1356).Monoid.of(Duration.ZERO, Duration::plus)takes the place of an anonymous class, and an existingSemigroupcan be the operation. See Semigroup and Monoid.Monoids.list(),Monoids.set(), andMonoids.string()now run in linear time incombineAll(#1692).EitherandMaybegain more conversions (#1405, #1406, #1407, #1404).Maybe.fromEitherandEither.fromOptionalconvert into each type.Eitheralso gainstoOptional,swap,orElseandorElseGet. See Reading an Either.- A successful
narrowallocates nothing (#1350).narrow,narrowWithTypeCheckandnarrowHolderbuilt the context for their error message before checking anything. They now build it only when a check fails. See What each step allocates. - Each
Lazyin aflatMapchain 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. RefandPromiselet tasks running at the same time share state, andmemoize()runs a task once for them all (#550). Each read and write of aRefis aVTask, and aPromiseis completed once and read by tasks that wait for it.memoize()shares one result between runs, and caches no failure. See Shared State.VResultPathandVTaskContextgainmemoize()(#1663). Both give a fresh cache on each run of the outer effect. A memoisedVResultPathkeeps aLeftas a computed value and can try again after a thrown exception. See Shared State.VResultPathruns in one call withunsafeRun()andrunAsync(), asVTaskPathdoes (#803).unsafeRun()returns theEitherthatrun().run()gave, andrunAsync()starts the task on a virtual thread and returns a future of it. A typed failure still arrives as aLeft, and only an exception the task throws escapes.Maybe,Tryand their Paths gainfold, andTryandValidatedgaintoOptional(#546, #1490, #1509).Maybe,MaybePathandOptionalPathtake the empty case first, andTryandTryPaththe failure first.foldFailureFirstis deprecated for removal in 0.7.0. See Reading a Try and Deprecated for removal in 0.7.0.ListPathandNonDetPathname the null they refuse (#1438). A null element, or amap,zipWithorzipWith3function that returns null, threw aNullPointerExceptionwith no message. The message now says which, asStreamPath's does.- A
Selectiveof your own runs only the branch its condition picks (#1358). The defaultwhenSran its effect for a false condition, and the defaultifSran both branches. Both now leave the choice toselect: one that keeps its contract skips what the condition does not pick, and one built fromapstill runs every effect. See Selective. mapErroronMaybePath,TryPathandCompletableFuturePathcarries the mapped error (#1332):recoverafter it sees that error, where it used to see the old one. A success is aRightand the mapper is not called.MaybePathandTryPathreturn anEitherPath.CompletableFuturePathreturns aVResultPath. See Recoverable (MonadError).toEitherPath,toMaybePathandtoTryPathfollowrecoveron a failedCompletableFuturePath(#1354). A cancelled future givesLeftof itsCancellationException, orNothing, instead of throwing.toTryPathholds the exception the future failed with, not aCompletionExceptionaround it.- A half-open
CircuitBreakeradmits a call only while running and successful probes are fewer thansuccessThreshold(#1481); it admitted every call. Any other call gets aCircuitOpenException, 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
CircuitBreakerguards 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.withCircuitBreakerAndRetryandResilience.protectretried aCircuitOpenException, so each remaining attempt waited out its backoff, was turned away, and the call ended inRetryExhaustedException. They now decline it whatever the policy says, and the caller gets theCircuitOpenException. See The Ordering Problem. - A call that one
Bulkheadguards twice takes one permit (#1502). A repository and the service that calls it, each guarding one dependency with one bulkhead, took two, so withmaxConcurrent(1)the call waitedwaitTimeoutand failed. The inner guard now runs on the call's permit, on its thread or under a timeout. See One Call, One Permit. - A
VStreamrecovers from a failure at any element (#1029).recoverWith,mapErrorandonErroracted on the first pull only. Arecoverafter a failedmapTasknow 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,mapChunkedand theparEvalMapoperators hand on what they read first. Arecoverafter aparEvalMapoperator carries on past a failed task.VStream.closeAfterFailureis deprecated for removal in 0.7.0. See When a task fails and Deprecated for removal in 0.7.0. parEvalFlatMapcloses the streams it built but never reached (#1454). When atakeorheadOptionstopped 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
VStreamfails with the exception its task threw (#1410). A checked one, such as anIOExceptionfrommapTask, a finaliser or a publisher, reached every terminal operation inside aVTaskExecutionException, or aRuntimeExceptionfromparEvalMap,parEvalMapUnorderedandmerge.run(), and the conversions that call it such astoListPath(), still wrap it. Par,ScopeandVStreamParfail with the task's ownThrowable(#1418). AThrowablethat is neither anExceptionnor anErrorreached the caller inside aRuntimeExceptiononce 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 whicheverJoinerwas handed out last, so another scope could change what it saw, and eachScopeJoinerkept that scope's results for as long as it lived.joinEither()on theScopegives the scope's own result as anEither. See Holding the result as a value.Instances.alternative(vstream())givesVStream'sAlternative(#1425). It failed with aClassCastException, because thevstream()token held a plain monad, so code had to nameVStreamAlternative.INSTANCE.Instances.monad(vstream())now returns that same object, which behaves as the monad did.- The compiler checks
Instances.monadError,monadZeroandalternative(#1321). A lookup for a capability the type's instance lacks, such asInstances.monadZero(either()), compiled and threwClassCastExceptionwhen it ran. It no longer compiles, and nor does aMonadErrordeclared with an error type its instance does not have. See What the compiler checks. VStreamPar.parEvalMapUnorderedemits 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 thanconcurrencytogether, so a slow consumer slows the reading.VStreamPath's does the same.VStreamPar.parCollectis deprecated for removal in 0.7.0 (#1427), withVStreamPath.parCollectandPathOps.parCollectVStream. A stream is read one pull at a time, so they run nothing in parallel and give the listtoList()gives. Put work you want run in parallel inparEvalMap's function, then calltoList(). TheMigrateDeprecationsTo0_7_0recipe rewrites each call. See Deprecated for removal in 0.7.0.- A
VTaskPathhands every handler the exception its task threw (#1396). A checked one, such as anIOException, reachedrunSafe,catchingandtoTryPath, and any step aftervia,thenorguarantee, wrapped in aVTaskExecutionException, so a retry onIOExceptiongave up at once. OnlyunsafeRun(), which cannot throw one, still wraps it. See VTaskPath. Context.recoverWithrecovers from a failure in an earliermaporflatMapfunction (#1443). An exception thrown by the function, or a function that returnednull, escaped arecoverWithlater in the chain, thoughrecoverandmapErrorcaught it. A recovery function that fails now hands its failure to the nextrecoverWithout.- A timeout cancels the task it timed out, as a
Scope's timeout does (#1372). When the time runs out,VTask.timeoutinterrupts the task and fails once it has stopped, so a retry over a timeout leaves no attempt running. EverywithTimeoutbutCompletableFuturePath's builds on it, as doResilienceBuilderand the circuit breaker'scallTimeout. 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 onVTask,IOPath,VTaskPath,VResultPathandVTaskContext. See Timeouts.- A
fromPublisherstream 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,CoyonedaandFreeApprograms no longer overflow the stack (#1448, #1460, #1470).Free.foldMapruns a deep program intoId,EitherorWriter, though aListstep with several results still adds to the stack. AFreeApinterpreter is also handed the instructions in the order written. See State, Free Monad, Coyoneda and Free Applicative. Naturalis the library's one natural-transformation type (#1455).GenericPath.mapKtakes aNatural, andVStreamTransformationsgivesNaturals. The effect package'sNaturalTransformationnow extendsNatural, and is deprecated for removal in 0.7.0 withFreePath.foldMapWithandFreeApPath.foldMapWith. TheMigrateDeprecationsTo0_7_0recipe rewrites each use. See Deprecated for removal in 0.7.0.WriterPath.listen()reads the log, asMonadWriter.listendoes, andtell(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 theMigrateDeprecationsTo0_7_0recipe renames each call totell(log). See Writer and Deprecated for removal in 0.7.0.- A
VStreamterminal operation stops at an interrupt (#1428).toList,fold,drainand the others did not check between pulls, so neither a timeout nor a cancelledScopecould stop a stream whose pulls never block. Each now fails with anInterruptedExceptionand closes what it has read, so the finalisers there run. See Running a stream. - Stopping one run of a shared
VStreamleaves its other runs alone (#1461). Atake(0), a failed first pull or aclose()on a stream another thread was reading released that thread'sbracketresource, ran itsonFinalizefinaliser, or stopped itsmerge,fromPublisherorparEvalMapUnordered. Each run now closes only what it opened. Seebracketopens and closes. VStream.fromStreamcloses the JavaStreamit reads (#1029). It read the stream through its iterator and never closed it, so itsonClosehandlers never ran, and aFiles.linesfile stayed open. TheVStreamnow closes it when a run that has pulled it ends, fails or stops early. See A file, a line at a time.Free.foldMapkeeps what each step's value holds besides its result (#1460). For a target that runs each step at once, such asWriterorList, it kept only the result. AWriterorWriterT<Id, ...>lost its log, aListits other elements and anEitherOrBothits warnings. Each value now reaches the target whole. See Free Monad.- A
Freeprogram over instructions with noFunctorof their own can now be run, throughCoyoneda(#1470).Coyoneda.foldMap(natural, functor)runs a held value through an interpreter, andCoyoneda.interpreter(natural, functor)gives the interpreter that aFreePathneeds when itsFunctorisCoyonedaFunctor. See Coyoneda. - Every Path's
getOrElseGetrefuses a supplier that returns null (#1489). OnMaybePath,EitherPath,ValidationPath,EitherOrBothPathandOptionalPath, and inMaybe.orElseGet, a null from the supplier was handed back, though the result type is non-null. It now throwsNullPointerException, asTryPath.getOrElseGetandEither.orElseGetalready did. - Stop a
runAsync()task by cancelling its future (#1412).cancel(true)on the future fromrunAsync()onVTask,VTaskPath,VResultPath,VTaskContextorVStream, or fromEffectBoundary.runAsync, interrupts the task, as a future from anExecutorServicedoes, andcancel(false)leaves it running. See Running a task. @GeneratePathBridgereads 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 anIndexOutOfBoundsExceptionfrom the processor.- A Path's type-mismatch message names the method and both Path types (#401, #1559). Every built-in Path words it as
MaybePathdid, and generated@PathSourcePaths use the same wording forzipWith. The message points to conversion methods and Path factories. See A step that returns the wrong kind of Path.
Spring
- An
@HkjHttpClientinterface can extend a generic base interface (#858). A client such asUserCrudApi 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. Unitworks over HTTP whereVoiddid (#1522, #1536). AUnitinside a JSON body writesnull, and an@HkjHttpClientmethod with aUniterror type reads no error body. AVoiderror type on such a client is now a compile error that namesUnit. See Nested values and Decoding Errors.- A
VTaskPathresponse timeout interrupts its task (#1412). Whenhkj.virtual-threads.default-timeout-msruns 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
@HkjHttpClientinterface takes a type-level@HttpExchangefrom 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
@HkjHttpClientbuild 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
@HkjHttpClientaccepts 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@SuppressWarningson 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
@PathVariablefrom a base compiled without-parametersis refused (#855). The base's class file names the parameterarg0, so the client boundarg0and the request failed at run time. The processor now sayscannot 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 deprecatesspring-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, implementHttpStatusCarrier, or give anErrorStatusResolverbean for a type you cannot annotate. A shared API module can use the first two through the newhkj-spring-boot-http, which depends on nothing from Spring. ItsHttpHeaderCarrierreplaces the deprecated one inweb.returnvalue. See Error Status Mapping.
Build and tooling
discarded-effectflags a droppedVTask(#1662). Calls likeref.set(7);,ref.update(f);andpromise.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@HkjHttpClientclients suppressdeprecationorremovalon 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
@HkjHttpClientannotations set to one failed the build or read the wrong value. So did@Deprecated(forRemoval = ...)and@SuppressWarningsbeside 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@Handlesmessages 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-mismatchsays where to type the chain or map the step's error.path-type-mismatchreads method references,VResultPathand the accumulating methods, names a conversion only where one exists, and reads aDefaultVStreamPathas theVStreamPathit 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=warnfailed the build withplug-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,
hkjInstallSkillsandhkjDiagnosticsfailed, and so did every build withskills = true, which runshkjInstallSkills. 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-openrewriterelease takes a 0.4.x project'sTry.foldcalls to 0.6.0 (#546). The swap inMigrateDeprecationsTo0_5_0now leaves 0.6.0'sfoldalone, since it swaps only afolddeclared 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.AddPathFamilyrewritesChainable<A>toChainable<?, A>, and likewise the other capability types, aPathProvider'screatePathincluded. See 0.6.0 Path family. javadocruns in a build with the HKJ Gradle plugin applied (#1385). With preview features on, the default, javadoc received--enable-previewwithout the release it needs, sojavadocfailed, and so didbuildin a project that publishes a javadoc jar. The plugin now passes--releaseas well, unless the task passes its own-sourceor--release. See Defaults.- The benchmark options the docs describe now work (#1439). The benchmarks read only
-Pincludes, so-Pjmh.iterations,-Pjmh.fork,-Pjmh.profilers=gcand the rest did nothing, and the--includesmost pages gave failed. The build now reads each one, and Benchmarks lists them. - A generator plugin needs only
hkj-processorfrom HKJ (#1376).BaseTraversableGeneratormoves 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 anhkj-processor-pluginsline it added to reach the base class. Itsmodule-info.javakeepsrequires com.palantir.javapoet;. See Step-by-Step Example. - The 0.5.0 migration rewrites and marks more (#1369, #1370, #1545). A
Voidsuccess becomesUnit, and aVoiderror is marked on the Paths,ValidatedandEitherOrBothtoo. Morenulls that 0.5.0 refuses are marked, with a lambda's mark on thenullit returns. See 0.5.0 deprecation migration andVoidbecomesUnit. - A source set using
@GenerateMapping,@GenerateMerge,@GenerateIsos,@GenerateErrorEnvelope,@PathSourceor@HkjHttpClientcompiles 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-Werrorneeds-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,
@GenerateLensesand@GenerateFocusamong 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).
@GenerateMappingand@GenerateMergerefuse Java 15 or earlier, and a mapping of lists, sets or maps compiles at--release16 to 20. At Java 17 to 20, a sealed mapping pair,@GenerateErrorEnvelopeand@EffectAlgebraare refused with one error. See Rules and Limits. - A
FieldMaskupdate compiles at--release16 to 21 (#1667). ItsImplpassed 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
StreamPathreads its source, examples that mixed kinds of Path, and theProfunctorandVTaskjavadoc. 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,MonadStateandMonadWriter. See Effect Paths. - You can have NullAway flag a null returned through
VTask.oforTry.of(#1371). In JSpecify mode alone, NullAway never checks what a lambda returns when passed as a JDKSupplier,CallableorBiFunction, as toVTask.of,Try.oforIO.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
EitherPathandVResultPath(#1466, #1467). Stay onEitherto hold and pass a result, and lift it to run steps along it. Async work with a typed error now points toVResultPath. - 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 thathkj-springbrings 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
TryPathandValidationPath, and aConfigContext.contramapthat takes functions with wider bounds. - @AmishaNATH2003:
Maybe.fromEither, and tests forNonDetPath.foldLeftgiven a null function. - @AnushreeKasturi:
foldRight,foldandfoldMaponNonDetPath. - @anzikidis:
toOptional()andswap()onEither. - @bardrop:
Lazychains that run each step once, across threads too, a retry that stops once its circuit breaker opens, and nullness refinements togetOrElseGet,OptionalContext.ioandAffinePath.ofNullable. - @Beehtrix: a clear refusal for
@GenerateErrorEnvelopeat Java 17 to 20, generator plugins that name a class more than once, and@HkjHttpClientdiamonds that differ only in@SuppressWarnings. - @buzztouniverse: bean fix lines that compile once followed, and an
OpticOpFunctor.mapthat applies its function. - @canakyuz: glossary entries for
FreeApPath,FreePathandGenericPath, andStreamPathpages 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
@ThroughFieldfinding an inherited getter. - @dannyward630: a clearer explanation of how a
StreamPathreads its source. - @Daulat1249:
unsafeRun()andrunAsync()onVResultPath,toListPath,foldwith a nullable result type, the move tospring-boot-starter-webmvc, and associativity tests for every shippedMonoid. - @dtsiaves:
VTask.asCallablethrowing a task's ownThrowableunchanged. - @EnesKartal:
foldonMaybe,MaybePathandOptionalPath, the reader, state and writer type classes in the glossary, and guidance on when to lift anEitherto anEitherPath. - @Imcharan17:
Monoids.list(),set()andstring()that combine many values in linear time. - @KTH1007:
Semigroups.string,Monoids.maximumandMonoids.minimumthat refuse a null argument when built. - @loveyadav8478-blip: an injected
TimeSourcein the audit-log example. - @ManosHatzi5: the
HashMultiSettraversal generator. - @Max-WX-Chen: the
discarded-effectcheck for a droppedVTask,memoize()onVResultPathandVTaskContext, and clearer messages for a missing handler and a mismatchedzipWith. - @MaxonT: pointing Where to Start and Path or Transformer? at
VResultPath. - @minutechreview:
ensureonEitherPath, six newNonDetPathoperations, an injectedTimeSourcein the shipping example, and four glossary entries. - @prash-spartanx:
Either.fromOptional. - @Rishankgupta08:
toOptional()onTryandValidated. - @sanidhya02: a fix for a
@GeneratePathBridgecrash on an inherited generic method, and a clear refusal of aVoid-bounded@HkjHttpClientsuccess type. - @tramslegend: glossary entries for
ListPath,NonDetPath,StreamPathandVStreamPath.
Upgrading from 0.5.0
Before you upgrade
- From 0.5.x, run
MigrateDeprecationsTo0_6_0while 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_0while still on 0.4.x (#546).foldreturns onTryandTryPath, failure first. A success-firstfoldleft from 0.4.x compiles again where both functions accept either argument, and runs them swapped:t.fold(v -> true, e -> false)now givestruefor 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
nullkey is a failureparsereports, not an exception (#1515). A generatedparse,patch,updateFromor fallible merge, andparseValues,parseKeysandparseEntries, threwNullPointerException; each now returnsInvalid, so catching that exception no longer catches it, and Spring answers 422, not 500, by default. Thebuildbulk forms still throw. See The null contract, precisely. - A
nullinside a map's key failsparse(#1525). A generatedparse,patch,updateFromor fallible merge answeredValidwhere a key it hands on as it is, a container such as aList<String>, held anull, and handed the domain that key. Each now answersInvalid, located under the key. See The null contract, precisely. - A mapping refuses a map holding two keys that
equalscannot tell apart, unless it is anIdentityHashMap(#1483). A same-typedMapcopy,parseValuesandbuildValueslost an entry; they now throw. Hold such a map as anIdentityHashMap, 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. Eachapplynow allocates its own, so two results that were equal, as records whoseequalscompares an array by reference, no longer are. See Same-typed containers cross as copies.
Core types
Validated.map, andmap2tomap5on its monad, throwNullPointerExceptionwhen their function returns null (#1318). They threwKindUnwrapException, so catching that, orIllegalArgumentException, around the call no longer catches it. See Values, never null.FunctionKindHelper.narrowthrowsKindUnwrapException, as the other kind helpers do (#1318). A nullKindthrewNullPointerException, so catching that no longer catches it. Another type'sKindthrewIllegalArgumentException, whichKindUnwrapExceptionextends, so catching that still does. See Whennarrowthrows.- A
Selectiveof your own no longer runs the effects its condition skips (#1358), unless itsselectis built fromap. The defaultwhenSran its effect on a false condition, and the defaultifSran 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.recoverWithnow catches a failure from an earliermaporflatMapfunction (#1443). Code that let such a failure escape arecoverWithgets the recovered value instead, and a recovery function's own failure reaches the nextrecoverWithout. A checked exception such a function throws, as Kotlin code can, reachesrun()inside aContextException, as one fromfaildoes.Free.foldMapinto aWriter,ListorEitherOrBothgives what each step's value holds (#1460). AWriter's log is no longer empty, and anEitherOrBoththat warned givesBoth, where it gaveRight. AListtarget runs the rest of the program, and its interpreter, once for each element a step gives.Constand the optics' folds refuse a null value (#1470).new Const<>(null)throwsNullPointerException, as does amapFirstorbimapfunction 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 aMonoid<Unit>, notMonoid<Void>. See Values, never null.- A
FreeApinterpreter 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 intoIdthat logs or calls a service, now does so in that order. Results, and the failuresValidatedaccumulates, were already in order. - A
Lazystep'sflatMapfunction runs once (#1608, #1611). A function with a side effect ran again each time aLazybuilt on its step was forced. A step now reportsisEvaluated()once its chain is forced, and a thread forcing a step that another is working out waits for it. - A deep recursion through
Lazy.flatMapkeeps every level until it ends (#1608). Each level'sLazynow 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). ALazythat needs its own value, or two that need each other on one thread, fail withIllegalStateException. Forced on two threads, two suchLazys wait for each other for ever, as twoLazy.defers already did.- A
Lazytries its work again after running out of memory or stack (#1655). AnOutOfMemoryErroror aStackOverflowErroris still thrown, but leaves theLazyunevaluated, so the nextforce()runs the work again. Before, every laterforce()threw the same error. ALazyPathdoes the same. See When the work fails. Semigroups.string(delimiter),Monoids.maximum(comparator)andMonoids.minimum(comparator)refuse a null argument (#1365). Each throwsNullPointerExceptionwhen called. A null delimiter used to join strings with the textnull, and a null comparator threw only once two present values met.
Optics
- Of two withers for one getter,
@ImportOpticssets through the capitalised spelling (#1148): the lens for a class with bothwithEMailandwitheMailbesideeMail()set through whichever the class declared first. It now sets throughwithEMail, and a note nameswitheMail, which a spec interface's@Withercan choose. - An optic interpreter that wraps each result in
Free.pureskips the operation's continuation (#1154): a program fromOpticProgramsruns as before, but a function mapped onto anOpticOp, throughOpticOpFunctororFree.translate, is not applied. Hand the result toop.k()and return what it gives. - A traversal or fold over a null
@Nullablecontainer no longer throws (#1633). Acatchof theNullPointerExceptionit threw no longer runs, and a generator plugin's body no longer sees such a null. A fold over a null@Nullablevalue that is not a container finds nothing:getAllgives[], not[null], andlength0, not 1. - A sorted collection keeps its order through a generated optic (#1430). A traversal over a
PSortedSetorPSortedMap, 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
IdentityHashMapholding two keys thatequalscannot tell apart (#1458), such as aHashMapwhose key changed after it went in. Writing one lost an entry; it now throwsIllegalArgumentException. Copy such a map into anIdentityHashMapfirst. AnIdentityHashMapcomes 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
OpticOprecord throwsNullPointerException, and so does anOpticProgramsfactory 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.setandsetAllstill accept a null new value. TraversableGenerator.recordTypeNamenames 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 readsbounds()from what it returns can tell. To declare a type variable, callProcessorUtils.typeVariableOf(context.elements(), parameter, context.targetPackage()).
Effect Paths
- A
ValidationPathkeeps its own semigroup through a step (#1314): the result ofvia,then,recoverWithandorElseaccumulated with the step's semigroup, and now accumulates with the receiver's. AftermapError, whose placeholder semigroup throws, a later accumulation now throws even past a step that had a semigroup; usemapErrorWithinstead. - An
EitherOrBothPathkeeps its own semigroup through a recovery (#1314): the result ofrecoverWithandorElseaccumulated with the recovery's semigroup, and now accumulates with the receiver's, asviaandthenalready did. mapErroronMaybePath,TryPathandCompletableFuturePathapplies the mapper (#1332): it used to hand back the same path, and it never called the mapper. A failure now runs the mapper, andrecoversees that error.MaybePathandTryPathreturn anEitherPath.CompletableFuturePathreturns aVResultPath.mapExceptionstill stays aTryPath.toEitherPathandtoMaybePathon a cancelledCompletableFuturePathno longer throw (#1354). They giveLeftof theCancellationException, andNothing.toTryPathon a failed future holds that future's exception. Code which caught aCancellationExceptionaroundtoEitherPathortoMaybePath, or matched aCompletionExceptionin atoTryPathfailure, no longer sees one.- A
VStream'srecoverWith,mapErrorandonErrornow 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, andrecoverwhen it ends the stream, close what they stop reading. - A failed
mapTaskelement holds its place in aVStream(#1029). After arecover, later elements pass through the operators between, anddropcan discard the failure. A finaliser orbracketrelease runs at close, not at the failure. - A
recoverplaced 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,mapChunkedandparEvalMaprun for the elements read before it, then fail, so aforEachorheadOptionsees them. A failed parallel task no longer cancels the others, so without arecovera failingparEvalMaprun waits for its batch's slowest task. - Code that pulls a
VStreamby hand gets aStep.Failfor a failed task, where the pull threw (#1029, #1437). That coversmapTaskand the parallel operators, whose null results and failingparEvalFlatMapfunctions count too. Close or read on from itstail. Aninstanceofchain ordefaultbranch misses it, and an exhaustive switch compiled against 0.5.0 throwsMatchException. - A
VStreamhands over a checked exception as its task threw it (#1410). Code that calledgetCause()on aVTaskExecutionExceptionfromrunSafe, or on aRuntimeExceptionfromparEvalMap,parEvalMapUnordered,mergeorfromPublisher, now receives the exception itself, as it does from a finaliser.run()still wraps one. - A forked task's
Throwablethat is neither anExceptionnor anErroris no longer wrapped (#1418). Code that calledgetCause()on theRuntimeExceptionfromPar,Scope.join,parEvalMaporparEvalMapUnorderednow receives theThrowableitself. So does a caller ofasCallable().call(), where acatch (Exception e)no longer catches it. - A
VTaskPathhandler sees a checked exception as its task threw it (#1396). Code that calledgetCause()on aVTaskExecutionExceptionnow receives the exception itself. That holds inrunSafeandcatching, in a handler or retry aftervia, in the future fromrunAsync(), and inVTaskContext.runOrElseGetandStreamTraversal.modifyVTask.unsafeRun()still wraps one. recover,recoverWith,mapErrorandtoEitherPathon aCompletableFuturePathkeep aCompletionExceptionthat has no cause (#1398). A handler that was given an emptyRuntimeExceptionnow gets theCompletionException.- 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 outtask.detachOnCancel(). - A half-open
CircuitBreakerlimits its probes (#1481). OncesuccessThresholdprobes are running or have succeeded, other calls get aCircuitOpenExceptionwith statusHALF_OPEN, so accept that besideOPEN. A probe an interrupt cannot reach holds its place until it stops; protecttask.detachOnCancel()to free it. - A
CircuitBreakercounts some calls differently (#1481). A call still running when the circuit changes state, byreset()ortripOpen()too, no longer moves it, though the metrics count it. ArecordFailurepredicate that throws counts a failure, and the call's own exception reaches the caller. - A call that one
CircuitBreakerguards twice counts each attempt once (#1482). Itsmetrics()counted each outcome at both guards, so a circuit opened at half itsfailureThreshold. 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
ResilienceBuilderorResilienceputs round a circuit breaker throws theCircuitOpenException(#1506). It retried it untilmaxAttemptsand threwRetryExhaustedException. Code that caughtRetryExhaustedExceptionthere should handleCircuitOpenExceptiontoo. - A call that one
Bulkheadguards 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 withdetachOnCancel, still takes a permit of its own. - A
fromPublisherstream subscribes when a run's first pull runs, not when it is built (#1442). A hot publisher, such as aSubmissionPublisher, 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, whichgetNumberOfSubscribers()shows. - Code compiled against 0.5.0 that calls
GenericPath.mapKor aVStreamTransformationsmethod must be recompiled (#1455). Each now namesNaturalin its signature, so the old call fails withNoSuchMethodError. AmapKcall that passes aNaturalTransformationstill compiles, with a removal warning. - A
VStream'srecover,recoverWith,mapErrorandonErrorlet an interrupt through (#1428). Their functions saw it, sorecoverended the stream with its value,mapErrorreplaced it and anonErrorhook logged it. Now the run fails with theInterruptedException. To give a value when a run is stopped, recover outside what stops it, as intoList().timeout(d).recover(e -> List.of()). - A
VStreamterminal operation on an interrupted thread fails before it reads (#1428). It read to the end unless a pull blocked.run()andrunSafe()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 withThread.interrupted(). VStreamPar.mergefails with theInterruptedExceptionwhen its reader is interrupted (#1428). It threw aRuntimeExceptionwith the message "Merge interrupted". NowrunSafe()gives theInterruptedException,run()throws it wrapped in aVTaskExecutionException, and arecoverafter the merge lets it through. Where code matched the message, match theInterruptedExceptioninstead.prependleaves the stream after its element alone until it is read (#1428).headOption()ortake(1)afterprependclosed that stream, running itsonFinalizefinaliser though nothing had read it, whereVStream.of(x).concat(stream)did not. To run a finaliser however far a run reads, attach it afterprepend. SeeonFinalize.- Closing a
VStreamyou pulled by hand no longer closes that run (#1461). On abracket,merge,fromPublisher,parEvalMapUnorderedoronFinalizestream,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.fromStreamcloses the JavaStreamwhen a run that pulled it ends (#1029). AnonClosehandler 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 withbracket, or read on withfromIterator(stream.iterator()). See A file, a line at a time.- A multi-source
mergetail pulled again gives the step it gave before (#1029). Pulling one tail again, or running its pulledVTaskagain, 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,parEvalMapUnorderedormergetail pulled by hand on an interrupted thread gives a step that needs no wait (#1562). An element already buffered threwInterruptedException, throughrun()andrunSafe()too, as did a keptfromPublisherorparEvalMapUnorderedstep. An interrupted wait still throws, and now sets the status again for all three. Terminal operations are unchanged. getOrElseGeton a Path, andorElseGeton aMaybe, throw when the supplier returns null (#1489). They handed the null back. Code that relied on that getsNullPointerException, withsupplier must not return null, orotherSupplieron aMaybe; return a value from the supplier.cancel(true)on a future fromrunAsync()interrupts the task (#1412). A sleep, wait or blocking socket call in it fails. The same holds forEffectBoundary.runAsync, and for aCompletableFuturePathover such a future, including one made bywithTimeoutorcompleteOnTimeout. Amaporviabreaks 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
Combinableor 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
@PathSourcePath'szipWithuses the built-in Paths' type-mismatch wording (#1559). The message names both Path types and points to conversions and Path factories. Code that matchedCannot zipWith non-TracedPathcan match the new prefixType mismatch in zipWith(): expected TracedPath. See Choosing a capability. - An Effect Context's
viano longer checks its step's kind when the chain runs (#1567), since javac checks it. A jar built against 0.5.0 that handsviaanother kind of context gets aClassCastExceptionin place of anIllegalArgumentException. One that callsviaon anEffectContextgets aNoSuchMethodError. Rebuild it against 0.6.0.
Spring
- A
Unitinside a JSON body writesnull, not"()"(#1522). A client that read that string, or"INSTANCE"underspring.jackson.use-jackson2-defaults=true, now getsnull. Upgrade the services that read it first: before 0.6.0, a reader refuses thenullor takes it as a Javanull, and an@HkjHttpClientthrows on aUniterror. - A
Uniterror no longer fails to decode (#1522). With the default decoder, an@HkjHttpClientmethod whose error type isUnitthrewResponseErrorDecodeExceptionfor an empty or foreign error body. It now givesLeft(Unit.INSTANCE), so code that caught that exception, and a retry or circuit breaker that counted it, sees theLeftinstead. - A
Voiderror type fails when its decoder is built, not on each error response (#1536).JsonResponseErrorDecoderand the default factory throwIllegalArgumentExceptionforVoid, namingUnit. So a client generated before 0.6.0 with aVoiderror type stops the application at startup, as does aVoidinhkj.client.status-error-mappings, even one no method used. - A primitive in
hkj.client.status-error-mappingsstops the application at startup (#1546). A mapping such as404: intapplied 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, andJsonResponseErrorDecoderFactoryrefuses one when it is built. - A request that times out interrupts its task (#1412). This covers a
VTaskPath, and aCompletableFuturePathoverrunAsync(). The 504 goes out as before. Start work that must outlive aVTaskPathresponse with its ownrunAsync()inside that path, or raisehkj.virtual-threads.default-timeout-ms. For a future, the limit ishkj.async.default-timeout-ms. ObservableEffectBoundary.runAsyncpasses 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
@HkjHttpClientwith no type-level@HttpExchangeof its own uses its base's (#1561). Its requests now carry the base's URL prefix, media types, headers and version. If the group'sbase-urlholds 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
@HkjHttpClientwhosegroupnames a constant another processor writes joins that group (#1584). It was registered under the group"<error>", so the group'sspring.http.serviceclient.<group>.*properties, such as itsbase-url, now apply to it.
What stops a build that compiled
| Area | Now fails the build | Do this | Issue |
|---|---|---|---|
| Build and tooling | With 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 used | Run, 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 Paths | A chain step of another kind of Path, or with an error, environment, state, log or witness type the chain does not carry | Convert the step, map its error, or type the chain on the wider error where it starts, as Common Compiler Errors shows | #1314 |
| Effect Paths | Code 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 Paths | A 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 Paths | A 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 -Werror | Match from Composable<String>, or build the concrete Path directly | #1314 |
| Effect Paths | A step after mapError on a MaybePath, TryPath or CompletableFuturePath that returns the Path it started from | Return an EitherPath from the step (a VResultPath after a CompletableFuturePath), or use recover or mapException before changing the error type | #1332 |
| Effect Paths | A 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 tooling | A 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 processing | Add -implicit:class, which the HKJ Gradle plugin adds, as Incremental compilation shows | #855 |
| Mapping | In an incremental Gradle build without -parameters, a @GenerateMerge spec that Gradle did not recompile: was read from a class file that records no parameter names | Compile with -parameters, which the HKJ Gradle plugin adds, as Incremental compilation shows | #855 |
| Spring | A 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 of | Compile the base with -parameters, write the name, as @PathVariable("id"), or redeclare the method on the client | #855 |
| Spring | In 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 of | Compile with -parameters, which Spring Boot's Gradle plugin and the HKJ Gradle plugin add | #855 |
| Mapping | With 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 make | Use Lombok 1.18.34 or later, or set lombok.addLombokGeneratedAnnotation = true in lombok.config | #855 |
| Build and tooling | A 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 wrote | Rename 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 |
| Optics | An 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 Paths | An exhaustive switch over VStream.Step, in code that pulls a stream by hand or in a stream of your own | Add 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 |
| Optics | A 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 form | Type the variable as AffinePath, and read with getOptional, as for any nullable field | #1633 |
| Optics | A 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 why | Declare the component with concrete type arguments, such as PSortedSet<String> | #1430 |
| Optics | With 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 rejects | Use 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 |
| Optics | A 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 error | Override 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 |
| Optics | A 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 |
| Optics | A 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 Paths | Code 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 was | Let 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 |
| Optics | A 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 writes | Do what the warning asks. For the annotation, name a hand-written class or leave it off. See Compiler Messages | #1598 |
| Optics | A 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 Paths | A @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 outright | Do 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 Paths | Code 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 Paths | A 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 Paths | A 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 each | Write a lambda that calls the form you mean, as in (kind, monadError) -> OutcomePath.of(kind, monadError) | #1007 |
| Effect Paths | A 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 |
| Mapping | A @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 accessor | Mark 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 |
| Mapping | A 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 generated | Call 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 |
| Spring | An @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 Object | Replace Void with org.higherkindedj.hkt.Unit. The default decoder then reads no error body and gives Left(Unit.INSTANCE) | #1536 |
| Spring | An @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 client | Declare org.higherkindedj.hkt.Unit as the success type, as for a declared Void | #1544 |
| Spring | An @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 them | Redeclare 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 |
| Spring | An @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 public | Declare @HttpExchange on the client, or add the dependency that declares the missing annotation or class | #1561, #1571 |
| Core types | A 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 constraints | Ask 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 types | Code 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 tooling | Build logic that reads the hkjInstallSkills task's outputDir as a Path | Read outputDir.get().asFile.toPath(), and expect .claude/skills at the root of the build in every project | #1374, #1373 |
| Build and tooling | Build 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: HKJChecker | Give 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
| Deprecated | Replacement | Recipe |
|---|---|---|
VStream.closeAfterFailure(stream, failure) | stream.close(); a failed mapTask task gives a Step.Fail, whose tail you close as an Emit's | By hand |
VStreamPar.parCollect(stream, batchSize) | stream.toList() | ReplaceParCollectWithToListRecipe, in MigrateDeprecationsTo0_7_0 |
VStreamPath.parCollect(batchSize) | toList() on the path | ReplaceParCollectWithToListRecipe |
PathOps.parCollectVStream(path, batchSize) | path.toList() | ReplaceParCollectWithToListRecipe |
Try.foldFailureFirst and TryPath.foldFailureFirst | fold(failureMapper, successMapper), the same two functions in the same order | RenameTryFoldFailureFirst |
Operation.FOLD_FAILURE_FIRST | Operation.FOLD, which Try.fold reports | By hand |
NaturalTransformation<F, G>, in org.higherkindedj.hkt.effect | Natural<F, G>, which it extends | ReplaceNaturalTransformationWithNatural, 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 does | RenameWriterPathListenToTell, 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 did | RemovePathSourceMonadArgumentRecipe, in MigrateDeprecationsTo0_7_0 |
HttpHeaderCarrier, in org.higherkindedj.spring.web.returnvalue | HttpHeaderCarrier, in org.higherkindedj.spring.http, which it extends | MoveHttpHeaderCarrierToHttpPackage, in MigrateDeprecationsTo0_7_0 |
ProcessorUtils.typeNameOf, resolvedTypeNameOf and typeVariableOf(parameter, targetPackage), in their forms that take no Elements | The 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 them | The GenerationContext form, the one a generator implements, naming each type with context.typeNameOf(type); context.targetPackage() is the package the String form is handed | By hand |
BaseTraversableGenerator.getTypeArgumentName(component, index) and getTypeArgumentName(component, index, targetPackage) | getTypeArgumentName(component, index, context) | By hand |
BaseTraversableGenerator.getGenericTypeName(component), with ValidatedGenerator's | getTypeArgumentName(component, 0, context), or index 1 for a Validated | By hand |
Previous: Unreleased: 0.7.0 Next: v0.5.0