Skip to content
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

Issue #3 - Changed classes to be records #5

Merged
merged 5 commits into from
Nov 6, 2021

Conversation

ReyhanPatria
Copy link
Contributor

I changed some classes in the data package to be records. I chose the classes to be converted based on how the previous code declared attributes in the class, I chose classes that declared all the attributes as final.

Then after converting those classes to records I had to change how other classes retrieved data using the generated getters from records.

Copy link
Member

@Majekdor Majekdor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks okay to me. Love all the getters records remove.

@Majekdor Majekdor dismissed their stale review November 4, 2021 14:44

Shouldn't be requesting changes.

@Majekdor
Copy link
Member

Majekdor commented Nov 4, 2021

Only looked at the changes in GitHub, not IntelliJ, but it all looks good to me. Waiting for review from the big boss Cassy.

@Majekdor Majekdor linked an issue Nov 4, 2021 that may be closed by this pull request
Copy link
Member

@funnyboy-roks funnyboy-roks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, I'd like to test it before merging, though.

Copy link
Member

@funnyboy-roks funnyboy-roks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing on our dev server, this error occurred when loading the server's pre-existing data. You can use this sample playerdata to test your code further.

@ReyhanPatria
Copy link
Contributor Author

@funnyboy-roks @Majekdor @Cassy343 So after testing a bit, I found out it's an error from Gson itself not being able to deserialize records properly, it's a known Gson issue. There are workarounds provided by the community, but the simplest fix is just to revert Birthday back to a class.

@funnyboy-roks funnyboy-roks merged commit 4dbedd8 into FarLandsMC:main Nov 6, 2021
funnyboy-roks pushed a commit to funnyboy-roks/FarLands that referenced this pull request Apr 26, 2023
…dsMC#5)

* Changed classes to be records

* Changed get methods to comply with records

* Reverted deleted toString function

* Reverted Birthday to class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert struct classes to records
3 participants