io7m-com / cedarbridge

Cedarbridge message protocol specification language
https://www.io7m.com/software/cedarbridge
ISC License
0 stars 0 forks source link

Upgrade to sealed classes #9

Closed io7m closed 2 years ago

io7m commented 3 years ago

The compiler is written in a manner that should make it easy to migrate to sealed classes when those get into an LTS JDK (likely JDK 17). Upgrade all pseudo-algebraic types in the compiler to sealed classes, and upgrade the code generator to generate sealed classes.

io7m commented 3 years ago

Variant types were specifically designed to be represented as sealed classes. There was no attempt made to provide any kind of visitor abstraction or anything like that, because that would result in an API-breaking change to the generated code when sealed classes were introduced and the visitors removed.

io7m commented 2 years ago

javapoet doesn't support these, so generation will be manual. Probably not a problem.

io7m commented 2 years ago

Done.