docs: explain intentional CartSummary instability#85
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the documentation comments for the CartSummary class in ProductList.kt to clarify that its lack of structural equality is intentional for testing the Dejavu library. The review feedback suggests using more idiomatic Kotlin Multiplatform terminology, such as referencing Any.equals() instead of Object.equals(), and refining the description of Compose recomposition behavior.
| // INTENTIONAL: regular class with identity-based equality (Object.equals). | ||
| // Keeping this unstable is part of the demo/test fixture; changing it to a |
There was a problem hiding this comment.
In Kotlin Multiplatform (commonMain), it is more idiomatic to refer to Any.equals() or "referential equality" rather than the JVM-specific Object.equals(). Additionally, since all properties are val and of stable types, this class is technically "Stable" in Compose terms; the recompositions occur due to the lack of structural equality, not type instability. Using "behavior" or "identity equality" instead of "unstable" avoids confusion with the Compose compiler's stability system.
| // INTENTIONAL: regular class with identity-based equality (Object.equals). | |
| // Keeping this unstable is part of the demo/test fixture; changing it to a | |
| // INTENTIONAL: regular class with identity-based equality (Any.equals). | |
| // Keeping this behavior is part of the demo/test fixture; changing it to a |
Summary
CartSummaryis intentionally not adata classin the demoTest Plan
JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./gradlew -q --console=plain :dejavu:jvmTest :dejavu:testDebugUnitTest apiCheckJAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./gradlew -q --console=plain :dejavu:iosSimulatorArm64Test :dejavu:wasmJsBrowserTest