-
Notifications
You must be signed in to change notification settings - Fork 874
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
Code generator record and enum updates. #7339
Conversation
0ac4822
to
e086f04
Compare
e086f04
to
2e166d1
Compare
2e166d1
to
09e12a3
Compare
i went back and forth with implementing record accessors as getter generator or implements / override generator. Ended up implementing it as override generator, since:
I still don't like that the templates for simple tasks like those here are user customizable since there is nothing to customize other than having to remove a link. |
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.
Looks good to me. Thank you!
Will take a look later today, thanks for working on this! |
java/java.editor/src/org/netbeans/modules/java/editor/codegen/ToStringGenerator.java
Outdated
Show resolved
Hide resolved
found a small issue where the equals/hashcode generator doesn't check if the methods are already there in the record, will fix it in a moment. diff: https://github.com/apache/netbeans/compare/09e12a32b98f0d9d26dc9e80249c24211a613948..fa3bc2a302fe103295b7d5d94b10ced1162114f3 |
fa3bc2a
to
8a4bbd4
Compare
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.
Makes sense to me, thanks!
record accessors: - javac generates final methods for records unless they are already in the code - code can't override them, but it can replace them using the abstract method impl generator record other generators: - made equals, hashcode and toString generators record aware - disabled getter/setter and property generator for records enums: - toString support for enums
8a4bbd4
to
7928dc1
Compare
Implement basic record code generation features.
records:
equals
,hashCode
andtoString
generators record awareenums:
toString
generator supports now enumsfixes #7167