-
Notifications
You must be signed in to change notification settings - Fork 835
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
Java Code Templates for records and sealed types #7088
Conversation
<!-- Record generation --> | ||
|
||
<codetemplate abbreviation="prec"><code><![CDATA[${no-format}private record ${Type}(${cursor}) {}]]></code></codetemplate> | ||
<codetemplate abbreviation="preci"><code><![CDATA[${no-format}private record ${Type}(${cursor}) implements ${classVar editable="false" currClassName default="getClass()"} {}]]></code></codetemplate> | ||
<codetemplate abbreviation="rec"><code><![CDATA[${no-format}public record ${Type}(${cursor}) {}]]></code></codetemplate> | ||
<codetemplate abbreviation="reci"><code><![CDATA[${no-format}public record ${Type}(${cursor}) implements ${classVar editable="false" currClassName default="getClass()"} {}]]></code></codetemplate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about letting rec
generate record ${Type}(${cursor}) {}
and purec
public record ${Type}(${cursor}) {}
?
Since i found declaring records inside methods is quite common, those would have no public
/private
modifier.
aa22e53
to
637e232
Compare
@mbien Would this be Ok with you? I went with |
Yes, if this makes it more consistent to other templates - please change it as you think its best. I am no heavy template user, I probably know less than 10. But rec and lofmofsof I will probably remember ;) |
The change is already there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use the abbreviations much either, but looks OK to me.
Well, I've started to work with Java 17 lately also using some records. It seems while new language features are supported, there is still a way to go.
This one is trivial to add a few code templates to work with records and sealed types.