wrap-java: handle sealed/permits in interfaces and classes#843
Open
ktoso wants to merge 2 commits into
Open
Conversation
1dd36d2 to
e0fac04
Compare
When we know the exact set of permitted subclasses we should include them in the generated macro such that we can then from the macro generate safe `as...()` methods. These are useful since it is common to use subclassing with sealed hierarchies like that. The normal `as` still exists.
e0fac04 to
c0e43e7
Compare
c0e43e7 to
d13e42d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the JavaClass and interface macros with additional permits which handle Java's
sealed.I decided to not change codegen so far, since we have a good enough
func as(T) -> T?already; so this is mostly docs; but we could generate way more now, including switching over the "case" of it using Swift enums.