Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DRSchlaubi
Copy link
Member

@DRSchlaubi DRSchlaubi commented Aug 31, 2023

The use of value classes for the Reset class has already caused issues implementing #855. However, it was isolated to native platforms. Unfortunately, this behavior will become a compiler error soon, so we need to change it. This can be achieved by simply using the backing Instant instead of Reset with AtomicRef.

Related Issues

#855
#69
Kotlin/kotlinx-atomicfu#291
KT-61584

@DRSchlaubi DRSchlaubi requested a review from lukellmann August 31, 2023 12:09
@DRSchlaubi DRSchlaubi marked this pull request as ready for review August 31, 2023 12:09
@lukellmann
Copy link
Member

if we have a breaking change here anyway, do we really need this wrapper around Instant at all?

@DRSchlaubi
Copy link
Member Author

Probably not

@lukellmann
Copy link
Member

let me see what i can do then

@lukellmann
Copy link
Member

ok, so i kept Reset as an @JvmInline value class, deprecated it and replaced the usages with plain Instant. with some annotation trickery, i think i managed to preserve binary compatibility, so only source compatibility is broken now (which is easier to fix).

@lukellmann lukellmann changed the title No longer use value class for Reset class in rate-limiter Deprecate value class dev.kord.rest.ratelimit.Reset and replace it with plain Instant Sep 3, 2023
@lukellmann
Copy link
Member

lukellmann commented Sep 3, 2023

can you take a look @DRSchlaubi? (can't request an review from you, you are the pr author)

@lukellmann
Copy link
Member

wait a second, i just noticed that we don't even have to change any public api, we can just box/unbox the Reset.value internally without api changes

@lukellmann lukellmann changed the title Deprecate value class dev.kord.rest.ratelimit.Reset and replace it with plain Instant Don't use value class Reset with AtomicRef Sep 3, 2023
Copy link
Member

@lukellmann lukellmann left a comment

Choose a reason for hiding this comment

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

simply using the backing Instant should do the job, what do you think @DRSchlaubi?

@DRSchlaubi
Copy link
Member Author

Looks good

@lukellmann lukellmann merged commit 7ae3daf into main Sep 3, 2023
@lukellmann lukellmann deleted the feature/no-value-reset branch September 3, 2023 16:06
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.

2 participants