You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
l is marked `@constructorOnly` but it is retained asa field in classLeak
Expectation
It should compile successfully, as the constructor argument shouldn't be captured.
Note
The compiler currently does capture the variable the moment it sees it passed to a lambda. Running CFR on the compiled code (when the annotation is not present), reveals:
The member starts out captured. The field is dropped if it is only used from the constructor. For the lambda case, lambda construction must happen before the constructor finishes.
Compiler version
3.6.4 and 3.7.0-RC1
Minimized code
Output
Compilation error
Expectation
It should compile successfully, as the constructor argument shouldn't be captured.
Note
The compiler currently does capture the variable the moment it sees it passed to a lambda. Running CFR on the compiled code (when the annotation is not present), reveals:
where one can see that
this.l
is indeed never used, the Lambda simply closes over the constructor argument as expected.The text was updated successfully, but these errors were encountered: