Closed
Description
Can we skip emitting unnecessary mixin methods in the new trait encoding scheme?
With revision retronym/scala@8ee7aca I compiled the following example:
trait T { final def m = 1 }
class C extends T
class D extends T
class A {
def foo(t: T) = t.m
}
- Both classes
C
andD
get anoverride def m = super[T].m
. Are the necessary? - Could the default method in
T
be markedfinal
? - Could we skip the mixin methods in
C
andD
ifT.m
was notfinal
?
In the current situation, the invocation t.m
in class A
is polymorphic: the bytecode is INVOKEINTERFACE T.m ()I
, which resolves to either C.m
or D.m
.