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
Fix#8599: Emit trait init methods only as static methods.
Concrete trait methods are encoded as two methods in the back-end:
* a default method containing the real body, and
* a static forwarder, to use for super calls (due to JVM reasons).
Previously, we did that also for the trait initializer methods
`$init$`. However, that causes unrelated default methods to be
inherited by Scala classes that extend several traits. In turn,
that prevents Java classes from extending such classes.
Now, for the `$init$` methods, instead of creating a static
forwarder, we *move* the entire body to a static method. Therefore,
we only create a static method, and no default method.
This corresponds to what scalac does as well (both what we do and
how we do it), although the previous "discrepancy" was not causing
any incompatibility between Scala 2 and 3 per se.
0 commit comments