# v0.4.0 (22 March 2026) {#v040-22-march-2026}

[v0.4.0 on GitHub](https://github.com/higher-kinded-j/higher-kinded-j/releases/tag/v0.4.0)

**SPI-Aware Path Widening, Expanded Plugin Ecosystem, and Focus DSL Restructure**

This release introduces SPI-aware path widening for the Focus DSL, allowing automatic `AffinePath` and `TraversalPath` generation based on container cardinality, expands the `TraversableGenerator` plugin ecosystem to 23 generators across 6 library families, adds `Traversal.asFold()` for read-only monoidal aggregation, restructures the Focus DSL documentation into dedicated pages, and delivers comprehensive test coverage and Javadoc quality improvements across processor modules.

- [SPI-Aware Path Widening](../optics/focus_navigation.md): Automatic path type inference based on container cardinality: `ZERO_OR_ONE` produces `AffinePath`, `ZERO_OR_MORE` produces `TraversalPath`, eliminating manual `.each()` and `.some()` calls in generated navigators
- [Cardinality-Based Widening](../optics/focus_containers.md): `TraversableGenerator` SPI extended with `Cardinality` enum, priority system (`PRIORITY_FALLBACK`, `PRIORITY_DEFAULT`, `PRIORITY_OVERRIDE`), `widenCollections` opt-in attribute, and wildcard type resolution for `? extends T`, `? super T`, and bare `?`
- [Nested Container Widening](../optics/focus_containers.md): Compound types like `Optional<List<String>>` resolve correctly through recursive cardinality analysis, with navigator field collision detection
- [Generator Plugin Ecosystem](../tooling/generator_plugins.md): 23 `TraversableGenerator` implementations across 6 library families: base JDK (Array, List, Set, Optional, MapValue), Apache Commons Collections4 (HashBag, UnmodifiableList), Eclipse Collections (ImmutableBag, MutableBag, ImmutableList, MutableList, ImmutableSet, MutableSet, ImmutableSortedSet, MutableSortedSet), Google Guava (ImmutableList, ImmutableSet), Vavr (List, Set), and HKJ native (Either, Maybe, Try, Validated)
- [Traversal.asFold()](../optics/folds.md): Conversion from any `Traversal` to a read-only `Fold` for monoidal aggregation, existence checks, and length counting via new `ConstForFold` applicative functor
- [AffinePath](../optics/focus_navigation.md): New `AffinePath<S, A>` for zero-or-one navigation in Focus DSL, with `Affine` optic interface supporting `getOrModify` and `set`
- [Portfolio Risk Analysis](../examples/examples_portfolio_risk.md): Capstone example demonstrating container navigation, SPI widening, and nested optics composition
- Focus DSL documentation restructured into dedicated pages: [Containers](../optics/focus_containers.md), [Navigation](../optics/focus_navigation.md), [Effects](../optics/focus_effects.md), and [Reference](../optics/focus_reference.md)
- [Tutorial 19: Navigator Generation](https://github.com/higher-kinded-j/higher-kinded-j/blob/main/hkj-examples/src/test/java/org/higherkindedj/tutorial/optics/Tutorial19_NavigatorGeneration.java): 7 exercises on annotation-driven navigator code generation
- [Tutorial 20: Container Navigation](https://github.com/higher-kinded-j/higher-kinded-j/blob/main/hkj-examples/src/test/java/org/higherkindedj/tutorial/optics/Tutorial20_ContainerNavigation.java): 4 exercises on SPI-aware container type navigation
- Automated SPI service declarations via Avaje SPI processor for plugin discovery

---

**Previous:** [v0.4.1](v0_4_1.md)
**Next:** [v0.3.0 to v0.3.7](v0_3.md)
