KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
679 stars 105 forks source link

Make use of Java 17 sealed types #955

Closed Sparky983 closed 7 months ago

Sparky983 commented 11 months ago

There are two main motivations for this change:

  1. It enforces @ApiStatus.NonExtendable in the type system.
  2. It allows code from future versions to effectively use Pattern Matching for Switch.

This change would need to be targeted for version 5.0.0 since it requires Java 17. It would also be very messy without the removal of AbstractComponent.

Additionally, I would like to lightly suggest that version 5.0.0 be written in Java 21 so that Adventure itself can take advantage of Pattern Matching for Switch.

kashike commented 11 months ago

441

459

zml2008 commented 7 months ago

We are a text component/ingame UI library, not a "use Java features" library. This appears to be an issue that assumes we are the latter.

Sparky983 commented 6 months ago

We are a text component/ingame UI library, not a "use Java features" library. This appears to be an issue that assumes we are the latter.

Sorry, I don't understand. I'm simply suggesting that in in Adventure 5.0.0, that interfaces such as Component and Tag become sealed.