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

misc: upgrade to Kotlin 2.0.0 #1105

Merged
merged 40 commits into from
Jul 25, 2024
Merged

misc: upgrade to Kotlin 2.0.0 #1105

merged 40 commits into from
Jul 25, 2024

Conversation

lauzadis
Copy link
Contributor

@lauzadis lauzadis commented Jun 20, 2024

Major changes:

Issue #

Description of changes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This comment has been minimized.

This comment has been minimized.

@lauzadis lauzadis added the acknowledge-api-break Acknowledge that a change is API breaking and may be backwards-incompatible. Review carefully! label Jun 21, 2024

This comment has been minimized.

2 similar comments

This comment has been minimized.

This comment has been minimized.

@lauzadis lauzadis marked this pull request as ready for review June 24, 2024 15:58
@lauzadis lauzadis requested a review from a team as a code owner June 24, 2024 15:58

This comment has been minimized.

/**
* The gzip compression algorithm.
* Used to compress http requests.
*
* See: https://en.wikipedia.org/wiki/Gzip
*/
public expect class Gzip() : CompressionAlgorithm
public expect class Gzip() : CompressionAlgorithm {
override val id: String // expect class members must be explicitly overridden in K2:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't know if this comment is necessary

@@ -62,8 +62,7 @@ public fun Any?.type(): String = when (this) {
is List<*>, is Array<*> -> "array"
is Number -> "number"
is Any -> "object"
null -> "null"
else -> throw Exception("Undetected type for: $this")
else -> "null"
Copy link
Contributor

Choose a reason for hiding this comment

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

question: was this causing issues anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it was a warning saying the "else" block was unreachable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was having trouble replicating the exact warning locally just now, so I reverted the change


@Test
fun testEquals() {
assertEquals(BigInteger("340282366920938463463374607431768211456"), BigInteger("340282366920938463463374607431768211456"))
Copy link
Contributor

Choose a reason for hiding this comment

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

style/nit: it would be nice to have a single format for these new tests you added for BigInteger and BigDecimal

  val value = "0.340282366920938463463374607431768211456"
  assertEquals(BigDecimal(value), BigDecimal(value))

This comment has been minimized.

This comment has been minimized.

Comment on lines -63 to +64
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Without this suppression which error(s) are seen? Just errors related to @Suppress("INAPPLICABLE_JVM_NAME")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's the only one. Since K2, they have started giving warnings for using this suppression, but the warning will be disabled again soon.

Comment on lines 17 to 25
public companion object Key : CoroutineContext.Key<TelemetryContextElement>

public val context: Context
override val key: CoroutineContext.Key<*>
override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
override fun plus(context: CoroutineContext): CoroutineContext
override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: The K2 migration guide shows overriding abstract members with the expect keyword, which is not included here. Do you know what the difference is? Is expect an optional keyword for abstract members of expect classes or does it change the meaning/implementation somehow?

Copy link

Affected Artifacts

Changed in size
Artifact Pull Request (bytes) Latest Release (bytes) Delta (bytes) Delta (percentage)
telemetry-provider-otel-jvm.jar 30,223 30,058 165 0.55%
testing-jvm.jar 8,229 8,196 33 0.40%
smithy-rpcv2-protocols-jvm.jar 6,129 6,110 19 0.31%
serde-jvm.jar 51,003 50,921 82 0.16%
aws-xml-protocols-jvm.jar 16,995 16,970 25 0.15%
serde-cbor-jvm.jar 104,262 104,350 -88 -0.08%
http-auth-api-jvm.jar 6,569 6,584 -15 -0.23%
smithy-client-jvm.jar 62,643 64,132 -1,489 -2.32%
identity-api-jvm.jar 29,475 30,336 -861 -2.84%
aws-event-stream-jvm.jar 84,602 87,249 -2,647 -3.03%
aws-signing-common-jvm.jar 66,496 68,628 -2,132 -3.11%
telemetry-api-jvm.jar 116,968 121,408 -4,440 -3.66%
aws-signing-tests-jvm.jar 457,311 475,309 -17,998 -3.79%
aws-credentials-jvm.jar 22,688 23,607 -919 -3.89%
http-jvm.jar 103,480 108,821 -5,341 -4.91%
smithy-test-jvm.jar 63,071 66,665 -3,594 -5.39%
http-auth-aws-jvm.jar 24,643 26,485 -1,842 -6.95%
http-client-engine-okhttp-jvm.jar 102,739 111,261 -8,522 -7.66%
http-client-jvm.jar 306,053 332,881 -26,828 -8.06%
logging-slf4j2-jvm.jar 22,146 24,181 -2,035 -8.42%
runtime-core-jvm.jar 796,827 892,030 -95,203 -10.67%
http-test-jvm.jar 58,739 66,311 -7,572 -11.42%
aws-signing-crt-jvm.jar 15,672 18,700 -3,028 -16.19%
aws-protocol-core-jvm.jar 20,194 24,245 -4,051 -16.71%
test-suite-jvm.jar 97,907 117,855 -19,948 -16.93%
serde-json-jvm.jar 70,256 85,727 -15,471 -18.05%
http-client-engine-crt-jvm.jar 51,492 63,109 -11,617 -18.41%
serde-xml-jvm.jar 177,196 223,945 -46,749 -20.88%
aws-signing-default-jvm.jar 52,480 68,851 -16,371 -23.78%
crt-util-jvm.jar 20,812 28,483 -7,671 -26.93%
http-client-engine-default-jvm.jar 14,584 24,643 -10,059 -40.82%
serde-form-url-jvm.jar 35,437 83,091 -47,654 -57.35%

@lauzadis lauzadis merged commit c9830c0 into main Jul 25, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge-api-break Acknowledge that a change is API breaking and may be backwards-incompatible. Review carefully!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants