Skip to content

Make fields for locals captured in traits non-final#9915

Merged
lrytz merged 1 commit intoscala:2.13.xfrom
lrytz:t12340
Feb 1, 2022
Merged

Make fields for locals captured in traits non-final#9915
lrytz merged 1 commit intoscala:2.13.xfrom
lrytz:t12340

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Jan 31, 2022

Other fields synthesized in subclasses of traits are already non-final.
This is required because these fields are assigned in trait setters.
The JVM enforces this for classfiles with version > 52, i.e., JDK 9+.

To ensure safe publication, the constuctor calls releaseFence.

Fixes scala/bug#12340. Follow-up for #7028.

@scala-jenkins scala-jenkins added this to the 2.13.9 milestone Jan 31, 2022
Other fields synthesizes in subclasses of traits are already non-final.
This is required because these fields are assigned in trait setters.
The JVM enforces this for classfiles with version > 52, i.e., JDK 9+.

To ensure safe publication, the constuctor calls `releaseFence`.
@lrytz lrytz marked this pull request as ready for review January 31, 2022 20:32
@SethTisue SethTisue changed the title Make fields for locals caputred in traits non-final Make fields for locals captured in traits non-final Jan 31, 2022
@lrytz lrytz requested a review from retronym February 1, 2022 09:54
@lrytz
Copy link
Member Author

lrytz commented Feb 1, 2022

I also compared the classfiles for library/reflect/compiler before and after this change, they are identical.

@lrytz lrytz merged commit a360263 into scala:2.13.x Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants