How are Scala traits compiled into Java bytecode?
Posted
by Justin Ardini
on Stack Overflow
See other posts from Stack Overflow
or by Justin Ardini
Published on 2010-03-31T23:59:28Z
Indexed on
2010/04/01
0:03 UTC
Read the original article
Hit count: 457
I have played around with Scala for a while now, and I know that traits can act as the Scala equivalent of both interfaces and abstract classes. Recently I've been wondering how exactly traits are compiled into Java bytecode. I found some short explanations that stated traits are compiled exactly like Java interfaces when possible, and interfaces with an additional class otherwise. I still don't understand, however, how Scala achieves class linearization, a feature not available in Java.
Could anyone explain or provide a good source explains how traits compile to Java bytecode?
© Stack Overflow or respective owner