-
Notifications
You must be signed in to change notification settings - Fork 33
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
Migrate DiskManager to Kotlin #334
Migrate DiskManager to Kotlin #334
Conversation
@get:Throws(IOException::class) | ||
val signalsBufferDir: File | ||
get() { |
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 think this is fairly idiomatic these days....but I'm happy to be talked out of this style/syntax if it is important to anyone.
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.
That's fair enough, considering that Kotlin allows you to access getter methods as if they were class fields later on, it seems like the question of defining them like this vs regular getters boils down to personal preferences really. I've seen custom accessors widely used for cases where the get()
or set()
body is quite small, like this one, although it does seem a bit strange to me to see them as big as the get()
in maxFolderSize
for example.
Regarding my personal preferences, I find it easier to read and quickly set apart in my mind what parts in a class hold business logic vs what others only store things in memory by using regular methods and fields, although it's probably a matter of getting used to different styles, so it's not the end of the world for me to use either approach.
1b3617f
to
79c04b9
Compare
So this started as a change to limit the coupling to the global ServiceManager. Initially it was just going to be a refactor, but it seemed to make sense to leverage some of the kotlin language features in the process. Because the
SimpleTemporaryFileProvider
was right next door, I picked that up as well.