feral icon indicating copy to clipboard operation
feral copied to clipboard

Use `sealed abstract case class`es to reduce bincompat surface

Open armanbilge opened this issue 3 years ago • 0 comments

sealed abstract case classes don't have apply or copy methods, but still have nice toString, hashCode, and equals.

Unfortunately they still generate unapply methods, so I've overridden those with package-private implementations to prevent the public one from being generated.

I've made the apply methods for events package-private. In ordinary use they should not be necessary, and importantly it protects our bincompat should AWS decide to add more non-optional fields, which technically they can do backwards-compatibly at any time.

Then, we can expose apply methods in the testkit like I propose doing for Context in https://github.com/typelevel/feral/pull/247. This will enable them to be mocked.

I didn't finish the DynamoDB-related stuff, I think I might like to make some bigger changes there in a followup.

armanbilge avatar Aug 14 '22 04:08 armanbilge