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
Attempting to write Scala code that relies on Java enums which implement an interface with a static method that captures the enum type as a method parameter, causes the illegal cyclic inheritance involving class error to occur during compilation. The caveat is to make sure the Scala class is compiled on its own, e.g. the Java enum and interface could be compiled separately and packaged into a JAR file. Another way to induce consistent failures is to explicitly set compile order to JavaThenScala, i.e.: compileOrder := CompileOrder.JavaThenScala.
Reproducible using SBT 1.0.3 with Scala versions 2.11.8, 2.12.3, 2.12.4
I looked at this one a bit. Unclear so far what's going on, but it only happens when the signature of valuesByName mentions E[], so you may be able to work around this by not using an array.
Attempting to write Scala code that relies on Java enums which implement an interface with a static method that captures the enum type as a method parameter, causes the
illegal cyclic inheritance involving class
error to occur during compilation. The caveat is to make sure the Scala class is compiled on its own, e.g. the Java enum and interface could be compiled separately and packaged into a JAR file. Another way to induce consistent failures is to explicitly set compile order toJavaThenScala
, i.e.:compileOrder := CompileOrder.JavaThenScala
.Reproducible using SBT 1.0.3 with Scala versions 2.11.8, 2.12.3, 2.12.4
Possibly related #3809 (using
-Ybreak-cycles
option had no effect).Originally asked on StackOverflow: How to resolve “Illegal cyclic inheritance” compilation error when using a Java enum in Scala?
The text was updated successfully, but these errors were encountered: