Updates on SIP-52: `@publicInBinary` and `-WunstableInlineAccessors`

SIP-52 will introduce 2 new concepts aimed at fixing binary compatibility issues with inline methods that access private members.

This feature will be added as an experimental feature in #18402. It will probably be experimental in 3.4 and stabilized in a later version.

1 Like

The recently reported Internally generated interim variables/fields from inline keyword + package private create collision with trait mixin · Issue #18646 · lampepfl/dotty · GitHub made me realize that the current handling of inline accessors could be a problem even for people who don’t necessarily care about binary compatibility since it can lead to name clashes resulting in cryptic errors. Would it be possible to detect these clashes and inform the user they should use @publicInBinary ?

The use of -WunstableInlineAccessors would flag these accessors before they conflict. Then using @publicInBinary would workaround this issue.

Once all libraries that care about binary compatibility use -WunstableInlineAccessors, we will be able to consider breaking the binary compatibility of these accessors. This implies that we will be able to change their names or move them, which is what we need to fix Internally generated interim variables/fields from inline keyword + package private create collision with trait mixin · Issue #18646 · lampepfl/dotty · GitHub and other similar issues.

1 Like