Open
Description
Minimized code
enum Color extends java.lang.Enum[Color] {
case Red, Green, Blue
}
@main def Test = println(Color.Red)
Output
// bytecode for Test
public void Test();
Code:
0: getstatic #31 // Field scala/Predef$.MODULE$:Lscala/Predef$;
3: getstatic #36 // Field Color$.MODULE$:LColor$;
6: pop
7: getstatic #40 // Field Color$.Red:LColor;
10: invokevirtual #44 // Method scala/Predef$.println:(Ljava/lang/Object;)V
13: return
which is equivalent to println(Color$.Red)
Expectation
public void Test() {
scala.Predef$.MODULE$.println(Color.Red);
}
this means that clients cannot swap out Color
for an enum compiled by Java