-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Annotate the enum constructor field instead of the class #3
Comments
This doesn't really make sense, also it would introduce global state since I would have to make sure no duplicate FromValues are present on other fields. Not going to be doing this |
Please elaborate
This is an implementation difficulty and not an issue with the feature itself. |
This is for matching and returning enum variants, and annotating a single field doesn't make sense since it's not based on that single field, the generated method is on the entire class |
The annotation wants you to specify a single field though because it generates the code around that field.
Annotating a field does not prevent generating code using the class the field is in. Annotating the field saves the user from issues like accidentally renaming the field without changing the name in the annotation. Additionally, annotating the field precisely shows that |
Currently usage:
More intuitive usage:
The compiler plugin will have to check if the class that is instantiated with the annotated field is an enum.
The text was updated successfully, but these errors were encountered: