Project Amber

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 instanceof & switch
  • let binding with destructuring (deconstruction patterns)
  • Enhanced Enums (available via the enhanced-enums branch of Project Amber)



  • Record#with - a thought experiment

    Recently, there were some interesting discussions about Record#copy() and Record#with(...) on the amber-spec-experts mailing 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.