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

Kotlin 1.4 dependency upgrade and language features #5947

Merged
merged 29 commits into from Sep 6, 2020

Conversation

yschimke
Copy link
Collaborator

@yschimke yschimke commented Apr 12, 2020

Update to Kotlin 1.4 and basic upgrade to functionality. This also includes okio 2.8.0.

@yschimke yschimke changed the title Testing with kotlin 1.4 Testing with kotlin 1.4 [not to land] Apr 12, 2020
@yschimke yschimke changed the title Testing with kotlin 1.4 [not to land] Kotlin 1.4 dependency upgrade and language features May 3, 2020
@yschimke yschimke force-pushed the kotlin_1_4 branch 2 times, most recently from 792191c to b847069 Compare May 3, 2020 08:30
@yschimke yschimke changed the title Kotlin 1.4 dependency upgrade and language features [WIP] Kotlin 1.4 dependency upgrade and language features Jun 1, 2020
@swankjesse
Copy link
Member

I don't think it helps us? I can't think of a place where explicit public or return types will make the code more clear.

@yschimke yschimke changed the title [WIP] Kotlin 1.4 dependency upgrade and language features Kotlin 1.4 dependency upgrade and language features Aug 15, 2020
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
@ZacSweers
Copy link
Contributor

@swankjesse explicit API mode isn't about code clarity as much as library authors ensuring they're intentional about public APIs, since it's easy to accidentally do that in kotlin's public-by-default model

@ZacSweers
Copy link
Contributor

Another thing you can do here is remove the explicit stdlib dependencies in build.gradle files

@yschimke yschimke marked this pull request as ready for review August 22, 2020 06:39
@yschimke
Copy link
Collaborator Author

@ZacSweers Thanks for the thorough review, I think after this lands a silent code cleanup might be a good next step. Pick up Kotlin IDE suggestions as well.

@sullis sullis mentioned this pull request Aug 22, 2020
@yschimke
Copy link
Collaborator Author

yschimke commented Sep 4, 2020

@swankjesse we ready?

Copy link
Member

@swankjesse swankjesse left a comment

Choose a reason for hiding this comment

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

Yay! The fun interfaces are nice.

id 'ru.vyarus.animalsniffer' version '1.5.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'me.champeau.gradle.japicmp' version '0.2.9'
id "ru.vyarus.animalsniffer" version "1.5.0"
Copy link
Member

Choose a reason for hiding this comment

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

The ' quotes don't do interpolation, the " quotes do. Motivation here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that isn't how my brain works, I wouldn't use different strings based on whether it needs interpolation. I'd just mainly use the interpolated form whether or not is has a variable part.

build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
@@ -378,18 +375,18 @@ fun Socket.peerName(): String {
* @param source the source used to read bytes from the socket.
*/
fun Socket.isHealthy(source: BufferedSource): Boolean {
try {
return try {
Copy link
Member

Choose a reason for hiding this comment

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

For what it's worth, the return value here is non-obvious with the finally clause. IntelliJ is obnoxious by making recommendations that make the code less clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The specific reason I like the return here is that it forces a return expression from all branches of the clause. Compiler would fail here anyway, but makes it clear that the result of the try catch is the final result of the method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can I argue this one?

Copy link
Member

Choose a reason for hiding this comment

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

Of course. And your argument makes sense.

okhttp/src/test/java/okhttp3/CipherSuiteTest.java Outdated Show resolved Hide resolved
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.

None yet

3 participants