Skip to content

[Bug]: Iso.reverse().compose() throws UnsupportedOperationException #123

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: api
File: api/optic/Iso.java (~line 390-393)
Severity: High

Summary

Calling compose() on a reversed Iso throws UnsupportedOperationException with the message "Compose on reversed iso". This is unexpected since regular Iso instances support composition.

Expected Behavior

A reversed Iso should either:

  1. Support composition (reverse the composition order), or
  2. Clearly document that reversed isos are not composable, with a rationale

Actual Behavior

Throws UnsupportedOperationException at runtime with a cryptic message, providing no guidance to the caller.

Suggested Fix

Either implement composition for reversed isos (mathematically: (iso.reverse()).compose(other) = other.compose(iso).reverse()) or add prominent JavaDoc on reverse() explaining this limitation.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdesignArchitecture/API design discussion or decision needed before implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions