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

Make some data class immutable #5762

Merged
merged 10 commits into from
Apr 14, 2022
Merged

Make some data class immutable #5762

merged 10 commits into from
Apr 14, 2022

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Apr 14, 2022

Following #5726 where some TODOs has been added, some data class was using var instead of val. This PR fixes that.

Hopefully it will not break anything, but please review carefully.

?.let { existingPollSummaryContent ->
eventAnnotationsSummaryEntity.pollResponseSummary?.aggregatedContent = ContentMapper.map(
PollSummaryContent(
myVote = existingPollSummaryContent.myVote,
Copy link
Member Author

@bmarty bmarty Apr 14, 2022

Choose a reason for hiding this comment

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

This code is quite weird to me the goal is to only keep myVote? CC @onurays

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it is to help reach myVote easily while rendering it.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

not for this PR, might be better suited as a separate type if possible 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you clarify? You mean having something like data class MutablePollSummaryContent with var and mutable types and a toPollSummaryContent() method, or is it something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant a dedicated MyVotePollContent(myVote), avoiding the need for the other values to be set to default values

@bmarty bmarty requested review from onurays and ouchadam April 14, 2022 10:31
@@ -50,6 +50,7 @@ ext.groups = [
'com.beust',
'com.davemorrissey.labs',
'com.dropbox.core',
'com.soywiz.korlibs.korte',
Copy link
Contributor

Choose a reason for hiding this comment

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

was this missing from the previous PR? 🤔 thought the CI would catch those errors

Copy link
Member Author

Choose a reason for hiding this comment

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

The CI does not call (yet) ./gradlew dokkaHtml which support has been added by the previous PR, and this addition is to be able to call ./gradlew dokkaJavadoc (as per the commit message)

@github-actions
Copy link

Unit Test Results

114 files  ±0  114 suites  ±0   1m 12s ⏱️ -18s
201 tests ±0  201 ✔️ ±0  0 💤 ±0  0 ±0 
674 runs  ±0  674 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 557808e. ± Comparison against base commit 9b7e94e.

/**
* Flag to indicate the signature from this device is valid.
*/
val valid: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename it as isValid?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right, something for a future PR :)

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

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

from the var to val perspective everything looks fine, seems that we were just using them to accumulate data for constructors

@bmarty bmarty merged commit a171a29 into develop Apr 14, 2022
@bmarty bmarty deleted the feature/bma/dokka_2 branch April 14, 2022 15:17
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.

3 participants