Skip to content

Commit 99ccaf4

Browse files
committed
second half of language tickets for compguide
1 parent 00f9d9a commit 99ccaf4

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

docs/topics/compatibility-guides/compatibility-guide-21.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,126 @@ perspective
191191
>
192192
> - 2.1.0: enforce consistent visibility for both getters and setters in K2; K1 remains unaffected
193193
194+
### Raise severity of JSpecify nullability mismatch diagnostics to errors
195+
196+
> **Issue**: [KTLC-11](https://youtrack.jetbrains.com/issue/KTLC-11)
197+
>
198+
> **Component**: Core language
199+
>
200+
> **Incompatible change type**: source
201+
>
202+
> **Short summary**: Nullability mismatches from `org.jspecify.annotations`, such as `@NonNull`, `@Nullable`, and `@NullMarked` are treated as errors instead of warnings,
203+
> enforcing stricter type safety for Java interoperability. To adjust the severity of these diagnostics, use the `-Xnullability-annotations` compiler option.
204+
>
205+
> **Deprecation cycle**:
206+
>
207+
> - 1.6.0: report a warning for potential nullability mismatches
208+
> - 1.8.20: expand warnings to specific JSpecify annotations, including: `@Nullable`, `@NullnessUnspecified`, `@NullMarked`, and legacy annotations in `org.jspecify.nullness` (JSpecify 0.2 and earlier)
209+
> - 2.0.0: add support for the `@NonNull` annotation
210+
> - 2.1.0: change default mode to strict for JSpecify annotations, converting warnings into errors; use `[email protected]:warning` or `[email protected]:ignore` to override the default behavior
211+
212+
### Change overload resolution to prioritize extension functions over invoke calls in ambiguous cases
213+
214+
> **Issue**: [KTLC-37](https://youtrack.jetbrains.com/issue/KTLC-37)
215+
>
216+
> **Component**: Core language
217+
>
218+
> **Incompatible change type**: behavioral
219+
>
220+
> **Deprecation cycle**:
221+
>
222+
> - 2.1.0: change overload resolution to consistently prioritize extension functions over `invoke` calls for extension functions with matching signatures; this change applies only after recompilation and does not affect precompiled binaries
223+
224+
### Prohibit returning nullable values from lambdas in SAM constructors of JDK function interfaces
225+
226+
> **Issue**: [KTLC-42](https://youtrack.jetbrains.com/issue/KTLC-42)
227+
>
228+
> **Component**: Core language
229+
>
230+
> **Incompatible change type**: source
231+
>
232+
> **Deprecation cycle**:
233+
>
234+
> - 2.0.0: report a deprecation warning for nullable return values in SAM constructors of JDK function interfaces
235+
> - 2.1.0: enable the new behavior by default
236+
237+
### Correct handling of private members conflicting with public members in Kotlin/Native
238+
239+
> **Issue**: [KTLC-43](https://youtrack.jetbrains.com/issue/KTLC-43)
240+
>
241+
> **Component**: Core language
242+
>
243+
> **Incompatible change type**: behavioral
244+
>
245+
> **Deprecation cycle**:
246+
>
247+
> - 2.1.0: private functions and properties in Kotlin/Native no longer override or affect public members in a superclass, aligning with JVM behavior
248+
249+
### Forbid access to private operator functions in public inline functions
250+
251+
> **Issue**: [KTLC-71](https://youtrack.jetbrains.com/issue/KTLC-71)
252+
>
253+
> **Component**: Core language
254+
>
255+
> **Incompatible change type**: source
256+
>
257+
> **Short summary**: Private operator functions such as `getValue()`, `setValue()`, `provideDelegate()`, `hasNext()`, and `next()` can no longer be accessed in public inline functions
258+
>
259+
> **Deprecation cycle**:
260+
>
261+
> - 2.0.0: report a deprecation warning for accessing private operator functions in public inline functions
262+
> - 2.1.0: raise the warning to an error
263+
264+
### Prohibit passing invalid arguments to invariant parameters annotated with @UnsafeVariance
265+
266+
> **Issue**: [KTLC-72](https://youtrack.jetbrains.com/issue/KTLC-72)
267+
>
268+
> **Component**: Core language
269+
>
270+
> **Incompatible change type**: source
271+
>
272+
> **Short summary**: The compiler now ignores `@UnsafeVariance` annotations during type checks, enforcing stricter type safety for invariant type parameters.
273+
> This prevents invalid calls that rely on `@UnsafeVariance` to bypass expected type checks.
274+
>
275+
> **Deprecation cycle**:
276+
>
277+
> - 2.1.0: activate the new behavior in K2
278+
279+
### Report nullability errors for error-level nullable arguments of warning-level Java types
280+
281+
> **Issue**: [KTLC-100](https://youtrack.jetbrains.com/issue/KTLC-100)
282+
>
283+
> **Component**: Core language
284+
>
285+
> **Incompatible change type**: source
286+
>
287+
> **Short summary**: The compiler now detects nullability mismatches in Java methods where a warning-level
288+
> nullable type contains type arguments with stricter, error-level nullability.
289+
> This ensures that previously ignored errors in type arguments are reported correctly.
290+
>
291+
> **Deprecation cycle**:
292+
>
293+
> - 2.0.0: report a deprecation warning for nullability mismatches in Java methods with stricter type arguments
294+
> - 2.1.0: raise the warning to an error
295+
296+
### Report implicit usages of inaccessible types
297+
298+
> **Issue**: [KTLC-3](https://youtrack.jetbrains.com/issue/KTLC-3)
299+
>
300+
> **Component**: Core language
301+
>
302+
> **Incompatible change type**: source
303+
>
304+
> **Short summary**: The compiler now reports usages of inaccessible types in function literals and type arguments,
305+
> preventing compilation and runtime failures caused by incomplete type information.
306+
>
307+
> **Deprecation cycle**:
308+
>
309+
> - 2.0.0: report warnings for function literals with parameters or receivers of inaccessible non-generic types and for types with inaccessible type argument; report errors for
310+
> function literals with parameters or receivers of inaccessible generic types and for types with inaccessible generic type arguments in specific scenarios
311+
> - 2.1.0: raise warnings to errors for function literals with parameters and receivers of inaccessible non-generic types
312+
> - 2.2.0: raise warnings to errors for types with inaccessible type arguments
313+
194314
## Tools
195315

196316
### Deprecate KotlinCompilationOutput#resourcesDirProvider

0 commit comments

Comments
 (0)