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

Compatibility guide for Kotlin 2.1.0 #4540

Merged
merged 17 commits into from
Nov 26, 2024
Merged

Compatibility guide for Kotlin 2.1.0 #4540

merged 17 commits into from
Nov 26, 2024

Conversation

daniCsorbaJB
Copy link
Contributor

Compatibility guide for Kotlin 2.1

@daniCsorbaJB daniCsorbaJB requested a review from a team as a code owner November 11, 2024 12:08
@koshachy koshachy changed the title Compat 2 1 0 Compatibility guide for Kotlin 2.1.0 Nov 11, 2024
@daniCsorbaJB daniCsorbaJB requested a review from ilya-g November 19, 2024 14:44
Copy link
Contributor

@zarechenskiy zarechenskiy left a comment

Choose a reason for hiding this comment

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

There are two minor issues with core language <-> stdlib changes, but the rest is good, thank you

Comment on lines 134 to 135
> - 2.1.0: report a warning
> - 2.2.0: raise the warning to an error
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> - 2.1.0: report a warning
> - 2.2.0: raise the warning to an error
> - 2.1.0: start throwing an exception when a map structural modification is detected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you - I updated it (removed the start from the beginning)

  • 2.1.0: throw an exception when a map structural modification is detected

@daniCsorbaJB daniCsorbaJB requested a review from ilya-g November 22, 2024 09:55
@AlejandraPedroza AlejandraPedroza self-assigned this Nov 22, 2024
Copy link
Contributor

@AlejandraPedroza AlejandraPedroza left a comment

Choose a reason for hiding this comment

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

Nice job! Left some suggestions, please take a look.

[//]: # (title: Compatibility guide for Kotlin 2.1)

_[Keeping the Language Modern](kotlin-evolution-principles.md)_ and _[Comfortable Updates](kotlin-evolution-principles.md)_ are among the fundamental principles in
Kotlin Language Design. The former says that constructs which obstruct language evolution should be removed, and the
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this part is fixed from previous guide versions, but, to make it more conversational and closer to users, could we change "The former and the latter", for:

"The first principle states that constructs which obstruct language evolution should be removed, while the second principle emphasizes that such removal should be well-communicated..."

or something like this?


In this document we introduce several kinds of compatibility:

- _source_: source-incompatible change stops code that used to compile fine (without errors or warnings) from compiling
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 bold the terms? For consistency with this type of list in our docs.

Copy link
Contributor

@AlejandraPedroza AlejandraPedroza left a comment

Choose a reason for hiding this comment

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

LGTM! Just one last thing:
"## Changes in K2 smart cast propagation"

Is the only one header that doesn't start with a verb. Should we change it for consistency?

@@ -0,0 +1,479 @@
[//]: # (title: Compatibility guide for Kotlin 2.1)
Copy link
Member

Choose a reason for hiding this comment

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

A related question: would it be possible to link the compatibility guide from the What's new page? (as we did in 1.9 and before)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Ilya - I asked the team - we'll link to it! 👍

Copy link
Collaborator

@sarahhaggarty sarahhaggarty left a comment

Choose a reason for hiding this comment

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

Standard library section looks good! Just a few minor suggestions.

>
> - 1.4.30: introduce locale-agnostic alternatives as experimental API
> - 1.5.0: deprecate locale-sensitive case conversion functions with a warning
> - 2.1.0: raise the warning to an error`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> - 2.1.0: raise the warning to an error`
> - 2.1.0: raise the warning to an error

> **Incompatible change type**: source
>
> **Short summary**: Freezing-related APIs in Kotlin/Native, previously marked with the `@FreezingIsDeprecated` annotation, are now deprecated.
> This aligns with the new memory manager that removes the need for freezing objects for thread sharing.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> This aligns with the new memory manager that removes the need for freezing objects for thread sharing.
> This aligns with the introduction of the new memory manager that removes the need for freezing objects for thread sharing.

>
> **Incompatible change type**: behavioral
>
> **Short summary**: K2 changes the behavior of smart cast propagation by introducing bidirectional propagation of type
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> **Short summary**: K2 changes the behavior of smart cast propagation by introducing bidirectional propagation of type
> **Short summary**: The K2 compiler changes its behavior for smart cast propagation by introducing bidirectional propagation of type

>
> - 1.4.30: introduce locale-agnostic alternatives as experimental API
> - 1.5.0: deprecate locale-sensitive case conversion functions with a warning
> - 2.1.0: raise the warning to an error`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> - 2.1.0: raise the warning to an error`
> - 2.1.0: raise the warning to an error

>
> - 2.1.0: deprecate and remove `kotlin-stdlib-common.jar` artifact

### Deprecate appendln in favor of appendLine
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### Deprecate appendln in favor of appendLine
### Deprecate appendln() in favor of appendLine()

>
> **Short summary**: Exposing types with lower visibility through type parameter bounds is now prohibited,
> addressing inconsistencies in type visibility rules.
> This change ensures that bounds on type parameters follow the same visibility rules as classes, preventing issues like IR validation errors in JVM.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> This change ensures that bounds on type parameters follow the same visibility rules as classes, preventing issues like IR validation errors in JVM.
> This change ensures that bounds on type parameters follow the same visibility rules as classes, preventing issues like IR validation errors in the JVM.

>
> **Short summary**: The `registerKotlinJvmCompileTask(taskName, moduleName)` function is deprecated
> in favor of the new `registerKotlinJvmCompileTask(taskName, compilerOptions, explicitApiMode)` function, which now accepts `KotlinJvmCompilerOptions`.
> This allows you to pass a `compilerOptions` instance, typically from an extension or target, with values used as conventions for the task’s options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> This allows you to pass a `compilerOptions` instance, typically from an extension or target, with values used as conventions for the tasks options.
> This allows you to pass a `compilerOptions` instance, typically from an extension or target, with values used as conventions for the task's options.

>
> **Incompatible change type**: source
>
> **Short summary**: support for these platform plugin IDs have been removed:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
> **Short summary**: support for these platform plugin IDs have been removed:
> **Short summary**: Support for these platform plugin IDs have been removed:

@daniCsorbaJB daniCsorbaJB merged commit bee846f into master Nov 26, 2024
4 checks passed
@daniCsorbaJB daniCsorbaJB deleted the compat-2-1-0 branch November 26, 2024 11:50
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.

7 participants