Project Amber aims at bringing sealed classes and interfaces as well as records and the assorted features such as pattern matching to Java.
Articles in this category explore the design-space of applications in a world where Amber has been sucessfully implemented, including, but not limited to:
- pattern matching, with full deconstruction patterns, in
letbinding with destructuring (deconstruction patterns)
- Enhanced Enums (available via the
enhanced-enumsbranch of Project Amber)
- Project Amber
- Enhanced Enums & JEP 301
- Concise method bodies
- Pattern matching for switch
this.xbinding of constructor parameters to reduce boilerplate in constructors
Recently, there were some interesting discussions about
amber-spec-expertsmailing list (1, 2) which has lead me to implement both methods with a very clear & typesafe way, which I’d like to discuss below. The code demonstrated below is available as Gist.