Skip to content

Start using Stability.Runtime more broadly#5705

Open
derekxu16 wants to merge 5 commits intomasterfrom
prr/derekx/start-using-runtime-stability-more-broadly
Open

Start using Stability.Runtime more broadly#5705
derekxu16 wants to merge 5 commits intomasterfrom
prr/derekx/start-using-runtime-stability-more-broadly

Conversation

@derekxu16
Copy link
Collaborator

This PR makes it so that if an element depends on the stability of an internal or public class defined in another file, the element will no longer infer the stability of that class and will depend on the runtime stability of that class instead.

Bug: 427530633

@kotlin-safe-merge
Copy link

kotlin-safe-merge bot commented Feb 27, 2026

Code Owners

Rule Owners Approval
/​libraries/​tools/​kotlin-​gradle-​plugin-​integration-​tests/​, /​libraries/​tools/​kotlin-​gradle-​plugin-​integration-​tests/​src/​test/​resources/​**/​*.​gradle.​kts kotlin-build-tools
/​plugins/​compose/​ @ShikaSD, @andrewbailey, @bentrengrove, @chuckjaz, @derekxu16

@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from c677b4d to 1f499e0 Compare February 27, 2026 18:26
@derekxu16 derekxu16 marked this pull request as ready for review February 27, 2026 18:29
@derekxu16 derekxu16 requested a review from ShikaSD February 27, 2026 18:30
Copy link
Collaborator

@ShikaSD ShikaSD left a comment

Choose a reason for hiding this comment

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

Great job here! A few top level comments:

  • Let's extract interface Unstable -> Uncertain change into a separate commit, it is an impactful change and having it separately will make it easier to review / revert.
  • Could you remind me why we cannot generate static val $stable anymore? Can we only change it to getters for internal classes? I would love us to generate a minimal amount of code when possible considering code size concerns expressed by 1p.

@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from 1f499e0 to c83c4ed Compare March 4, 2026 19:26
@derekxu16
Copy link
Collaborator Author

I’m using fixup commits to make this easier to review. I’ll squash them with git rebase --autosquash and reupload once this PR is approved.

@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from 51816b9 to f5189cc Compare March 9, 2026 18:22
@ShikaSD
Copy link
Collaborator

ShikaSD commented Mar 13, 2026

Could you please attach Relnote to the corresponding commits? The release notes script will pick up those automatically, and we definitely want to surface these changes.

...expect for those explicitly marked as known stable

Relnote: "Started inferring the stability of all interfaces to be
  `Stability.Unknown`, expect for those explicitly marked as known
  stable."
@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch 2 times, most recently from 87cad39 to a6bedbc Compare March 16, 2026 20:03
@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from d7162e7 to a8201e6 Compare March 17, 2026 19:08
@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from a8201e6 to 622c7e1 Compare March 23, 2026 19:09
@kotlin-safe-merge kotlin-safe-merge bot dismissed ShikaSD’s stale review March 23, 2026 19:09

New changes affect files owned by this reviewer. Re-review required.

@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from 622c7e1 to 3c016e2 Compare March 23, 2026 20:45
ShikaSD
ShikaSD previously approved these changes Mar 25, 2026
@ShikaSD
Copy link
Collaborator

ShikaSD commented Mar 25, 2026

cc @Tapchicoma to approve integration tests

@derekxu16 derekxu16 requested a review from Tapchicoma March 25, 2026 13:44
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to run the test with the latest max supported Gradle version - just use @GradleTestVersions(minVersion = TestVersions.Gradle.MAX_SUPPORTED

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 second build performed in this test uses a constant Kotlin version of 2.3.10

buildOptions = defaultBuildOptions.copy(androidVersion = agpVersion, kotlinVersion = "2.3.10"),

so if I use TestVersions.Gradle.MAX_SUPPORTED, I think this test could unexpectedly break if TestVersions.Gradle.MAX_SUPPORTED becomes incompatible with Kotlin 2.3.10.

Copy link
Contributor

@Tapchicoma Tapchicoma left a comment

Choose a reason for hiding this comment

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

It would be nice to update test

Relnote: "Started using `Stability.Runtime` more broadly. Now, when an
  element depends on the stability of an `internal` or `public` class
  defined in another file, the element will no longer infer the
  stability of that class and will depend on the runtime stability of
  that class instead."

Bug: 427530633
On JVM, there is now different logic governing when runtime stability is
used, so the code reading the known stable bit of stability bitmasks has
become unreachable. On other platforms, the code reading that bit is
also unreachable, because when the stability of a module is analyzed,
any declarations encountered with origin `IR_EXTERNAL_DECLARATION_STUB`
are guaranteed to be from a different module.
…tComposeLowering`

This CL makes it so that a getter call is inferred as static only when
it is an invocation of a default getter of a read-only property, and the
call is made in the same file that the property is defined in.

Bug: 427530633
@derekxu16 derekxu16 force-pushed the prr/derekx/start-using-runtime-stability-more-broadly branch from 3c016e2 to 254c7f0 Compare March 25, 2026 19:47
@kotlin-safe-merge kotlin-safe-merge bot dismissed ShikaSD’s stale review March 25, 2026 19:47

New changes affect files owned by this reviewer. Re-review required.

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.

3 participants